It's a typo that carried over to the second code example of trying to read the file too? Is the sample code completely untested?
the example is fixed, thanks for spotting that
the example is fixed, thanks for spotting that