Added gracefull closing of websocket server