Add support for properly disconnecting players who close their browser window

And reconnect them if they come back online