Make the check that the file is open more readable.
I didn't check/test the change in commit adfbb389. Correct this.