ws: Fix race condition during ssh transport shutdown

Without this change on certain machines, in certain environments
we would see messages like the following:

```
cockpit-protocol-Message: 127.0.0.1: failed to process channel: Socket error: Success
```