If either end (LwIP or the SOCKS connection) closes both halves of the connection, then both connections should be dropped.