Gracefully handle lost connections.