closing the socket when the response is empty