Close websocket connection before reconnecting if exists