Fix error message bug when can't open file due to permissions