[SPARK-3083] fix unnecessarily removing sendingConnection when closing connections

Currently in `ConnectionManager`, when a `ReceivingConnection` is closing, the corresponding `SendingConnection` would be removed twice. It causes unnecessary errors when removing `sendingConnectionManagerId` from `connectionsById`. There are also redundant codes in the implementation.