Don't disconnect if we're already disconnected

* The connected boolean reflects application state; the socket may
  already be closed.