Added quit and tried tweaking the closing of the websocket