at_halt/1 Register Goal to be run from PL_cleanup(), which is called when the system halts.
retractall/1 All facts or clauses in the database for which the head unifies with Head are removed.
thread_at_exit/1 Run Goal just before releasing the thread resources.