Fixed a potential crash if a connection gets remotely closed in the same moment a new connection is to be opened