Register the function f to be called if SWI-Prolog is halted.
The function is called with two arguments: the exit code of the process
(0 if this cannot be determined) and the closure argument
passed to the PL_on_halt()
call. Handlers must return 0. Other return values are reserved
for future use. See also at_halt/1.bugAlthough
are called in FIFO order, allat_halt/1
handlers are called before allPL_on_halt()
handlers. These handlers are called before system
cleanup and can therefore access all normal Prolog resources. See also PL_exit_hook().