Added clearing the active connections on retry.

I did this because if we just close the connection then we end up in a weird
state where part of the system thinks the conneciton is closed and the rest of
the system doesn't. Therefore, I added the clearing of active connections
which tells the rest of the system that the connection no longer exists.