Avoid calling fclose(false)

The previous code would always call fclose(false) if the file was not successfully opened - resulting in a PHP notice.