checking for socket isClosed()