Handle SSL closed socket bug

There is a bug in the python socket library wherein attempting
ssl.read/write on a closed socket raises an AttributeError instead of
IOError. We need to catch that case and raise an IOError.