Minor fixes

* Close SSH sessions, avoiding leaving connections open
* Correctly output error message on failed connection
* Fix crash on --hostfile being missing
Refactor ssh client lifecycle