With ArcaOS or any system with XWorkplace installed, right click on Desktop, open Properties, go to the XShutdown tab and click Create XShutdown folder. This will give you a shutdown folder that works like the Startup folder, but the opposite, any objects in it will be run when running shutdown.