You can call killAllProcesses() of the ApplicationContext class to exit the current application.
After this API is called, all processes in the application are terminated one by one.