Given that it works some of the time, have you tried running a recover on this file? See if any issues are reported, then test the recovered copy for a bit even if no issues are reported to see if you still get the same issue.
Things to keep in mind about Recover:
While Recover almost always detects and fully corrects any problems with your file...
- The recovered copy may behave differently even if recover reports "no problems found".
- Recover does not detect all problems
- Recover doesn't always fix all problems correctly
- Best Practice is to never put a recovered copy back into regular use or development. Instead, replace the damaged file with an undamaged back up copy if this is at all possible. You may have to save a clone of the back up copy and import all data from your recovered copy to get a working copy with the most up to date information possible.
And here's a knowledgebase article that you may find useful: What to do when your file is corrupt (KB5421).
Thank you for replying, PhilModJunk,
I never considered that the file might be corrupted. I guess I could mess around with the Recover function, although wouldn't it be strange if the script was the only thing corrupted?