ws: Fix race when disconnecting from an ssh transport

Closes #574
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>