Additional fix for #236: make sure the client is stopped before executin...

...g the closing code in a different thread to fail fast