Handle IOError in __del__. PEP8