CLC-2617 Fix connection-clearing logic