Yes I'm afraid :) the problem is that if the current function raises an Exception before `fid.close()` the file is not closed properly. By doing all the reading in the `*hack* *hack*` block, any error will automatically close the file (so you won't need  `fid.close()` anymore). If it's too much I can make a PR into your PR :)