Fixing a deadlock at close during reconnect