less specific check for closed socket

This fixes issue #508 for me, but maybe there is a good reason this check is so overy specific about the return value being a string?