Add function to close any open windows nicely if possible and shutdown/reboot