Implement websocket closing in the worker, and handle unexpected websocket disconnections in the UI.