Use file object's .closed instead of _istream_open