This will double-`close` the socket if the last thing we did was fail a `connect()` call.