Do not raise exceptions when stdio is closed 

Question was calling methods on nil and `Errno::EIO` was raised.

This way you can properly handle `Interrupt` exception.
Merge pull request #1172 from mikz/patch-2

Do not raise exceptions when stdio is closed