Catch OSError when checking for file permissions