Mohsen, I happen to be using this script today and I was running into a similar issue, which I have now resolved. I have other issues going on, but I thought I’d share what worked for me to get the index to generate.
I didn’t actually get an error, my Indesign would simply crash, every single time. What I found is that there were errors in my coding which made the script spaz out. I was using ID CS6 and I haven’t tried it in other versions of ID.
The text file that I received from the client had been converted over from excel so there was a header row that didn’t conform to the required script. I also found a handful of references that had a semi-colon at the end of the string of references and before the tab.
Once I fixed the coding errors, the script ran flawlessly. Hopefully your fix is as easy as mine. I was able to run a list of about 240 terms in less than 10 seconds. Good luck!