Avoid infinite waiting for writes when a connection was is terminated by the remote peer in the libevent driver.
Avoid closing a connection that was possibly closed by the server already (and the resulting exception).