Not really. You've only given a small part of your code and it's hard to say what's really going on, especially since this code is working with file IO.

Why don't you try using your debugger and...