Exit when connection is closed.