IsSocketConnected threw an exception for closed sockets