It's certainly a bug in iterFile -- I think it'll have to be modified to close the file on EOF, not after returning a continuation. Semi-working in the compiled version is probably just a quirk of the garbage collector and/or OS.