hopefully smarter socket/sslsocket closing