For me it looks like this is an internal synchronization problem as it also have existed for some macro commands in the past. For example on opening a file many steps are done in the background like checking file format, line termination with conversion to DOS or not, encoding, wrapping, syntax highlighting, updating function list, updating auto-complete list, execute macro (because one is specified for "OnLoad"), ...
If the script engine continues before all this procedures have finished, the next script command(s) can fail. So I guess, there are some internal "synchronization" problems between all the threads and procedures executed for some commands and the script engine.
Well, I'm not familiar with the Windows task and thread handling mechanism. I only know about the principles because I have written a small real-time operating system for one PCB of our protective devices where such problems must be also avoided by using semaphores and interrupt routines called by other programs already running. That's really not easy to handle (especially in real-time).
Best regards from Austria