be nicer about closing sockets