System.exit(int retcode) is a method to immediately terminate your application.
Presumably the operating system will tidy up after you and dispose of all the native
GUI (Graphic User Interface) resources you were using. Ironically programs
don’t even start processing events until the main routine has exited via return
— not via System.exit. System.exit shuts down all the event processing.