Fixed bug with closing from the server