Fixed scripting thread leaking into the core memory