Registers a callback to be called when a runtime is terminated.
Function to call when runtime is terminated
Registers a callback to be called when a runtime is terminated.