Fixed closing of the server, now fully working