Better handling of Connection closing.