Send logout command before disconnecting

We just close the connection when the we're told by the user to
disconnect. What we really should do is send the logout command first
and close the connection once we receive a reply from the server.

Signed-off-by: Marcus Karlsson <mk@acc.umu.se>