I am running it on XP, using Cygwin. I run the test one after the other, so could it be that the file is not properly closed before the next test iteration comes along and try to read from the same input file again?
Ooops forgot to mention this the first time around, when the script hangs, the shell becomes inactive and I have to close the cygwin rxvt terminal sessions (I can't use the terminal session any longer after the script hangs).