Fixes concurrency issue with ScriptEngine timers