Horrible attempts to deal with the multiple-tab and unclosed WebSocket problems.