clean up outerhandle when a tcpdns socket is disconnected
this prevents a crash when some non-netmgr thread, such as a recursive lookup, times out after the TCP socket is already disconnected.
Closes #1937 (closed), #1938 (closed)
Edited by Michał Kępień