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

SendingConnection#close is called from 3 threads on the same instance.
For example, 1st thread of handle-read-write-executor calls ReceivingConnection#close -> SendingConnection#close,  2nd thread of handle-read-write-executor calles SendingConnection#close and 3rd thread of connection-manager-thread calls ConnectionManager#run -> SendingConnection#close.

I think, if it threw exception from any methods in close(), connection is not marked as closed because one of those thread is expected to close resources even if another thread fail to close.

And synchronized block is for protect being called SendingConnection#close from 3 threads.
It can be one of following situation.
(1) One thread of handle-read-write-execuor evaluates key.cancel in SendingConnection#close
(2) Then, connection-manager-thread calls removeConnection via callOnCloseCallback and evaluates "connectionsyKey -= connection.key". This should be fail because connection.key is null at this time.

After (2) above, connection-manager-thread expects connectionsByKey.size != 0 in ConnectionManager#stop but that size cannot be 0 and we get log message "All connections not cleaned up".