Handle cases where the socket is closed before being passed to the server

See #32