Fixed crash when closing server