I think you are saying that the code seems to work correctly but at some point you get those error messages in log window.
Obviously the error relates to file IO, so that should give you a clue as to where the problem is. However, if there is still ambiguity you can try the followingdebugging techniques:
1. Use the debugger to step through your code to see the point at which the error gets raised
2. Pop some 'show' statements in your code: I just do, show("a"),show("b"), etc, and see where the error occurs with respect to my show statements
3. Pop a Throw statement in yoiu code. Keep moving it downwards until you get to the point where the error occurs.
-Dave