Hack around the resource leak by immediately closing the p2p tcp socket as soon as we get an exception during connection.