Fix a crash when disconnecting the websocket

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>