You must crate a Procedure/Function with just CLEAR EVENTS in it, and in the main programm before READ EVENTS put:
ON SHUTDOWN DO MyShutProc
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.