Monira,
Considering the number of input files, I suspect one possibility is that the computer ran out of memory. Test your script with a small number (e.g., 4) of subjects, and see if it works. If it does, you may need to find a computer with a larger memory.
Gang