Defines code to be executed when the user or operating system attempts to close the console the program is running inside.