Reset and clear directory before connect

We could get the directory view into an inconsistent state if we
reconnected while we we're already connected, which under certain
circumstances could lead to a crash. Reset and clear the directory view
before connecting, so that it is in a good state when we get connected.

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

We may reconnect during an already connected session. Clear any saved
state by disconnecing before attempting to connect.

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