atexit module

binaryninja.atexit.register(func, *targs, …) register a function to be executed upon normal program termination