FIXED: Possible crash on halt if there are detached Prolog engines.
Honnix Liang.