Additional fix for potential race condition which occurs when a user cancels a connection attempt

- Fixes #1986