Registers a system shutdown handler so user can do some cleanup before system is shutting down. Note: Once system shutdown starts, you are unable to cancel it.
Example
fin.System.registerShutdownHandler((shutdownEvent) => {
// save state or cleanup
console.log('do some cleanup before shutdown');
// Notify app is ready for termination.
shutdownEvent.proceed();
})
.then(() => console.log('Shutdown handler registered!'))
.catch(err => console.log(err));