except right exception that file module raised
Merge pull request #7753 from hvnsweeting/fix_file_state

except right exception that file module raised