Ensure it closes the socket on tests