Yes, I am aware of this problem (it has been reported some time ago). It seems to be a bug in the JavaScript engine, and so far I haven't found a solution.
This bug should be fixed in version 1.8 of PixInsight. For now, just make sure that you don't leave any unmatched curly brackets in your scripts, and all will be fine. Sorry for the inconvenience.