[SPARK-3106] Fix the race condition issue about Connection and ConnectionManager

Yes, Connection#close synchronize partially but all we should protect is key cancellation. If a thread (Thread-A) enter L286, no threads cannot cancel the key in Connection#close() until Thread-A finishes key-related operations.