Fixed thread initialization problems

Fixed a bug in which the game was not starting anymore for a player
closing the browser. The thread is now created once and destroyed in the
case in which another similar thread was open.
The task initialized message is also sent just once.