Close socket to receive when the server is stopped