Avoid calling fclose(false)

The previous code would always call fclose(false) if the file was not successfully opened - resulting in a PHP notice.
Merge pull request #522 from DavidAnderson684/patch-1

Avoid calling fclose(false)

* DavidAnderson684/patch-1:
  Avoid calling fclose(false)