thank you both.
great! I thought on_exit is only called on sys_exit. Sorry Sivan I could not belive that on_exit got called even on engine crash.
So I gave on_exit the functionality to create a single file in the folder.....and yes a forced crash let the file occuring before the engine dies.
Works with ESC key too. Now I have the event for cleaning work
Thank you again.