Close client when it fails to communicate with server