Preventing file corruption on Qube shutdown?

I’m running into file corruption problems for apps that are not closed when a qube shuts down.

I tried scripting a killall for open processes…but that caused its own set of corruption issues.

Anyone running into this problem, and have a solution?

Probably not the solution you’re looking for, but I’ve adapted Sven’s cached DVM script to my liking and am using it, among other things, to shut down VMs. If you bind the shut down command /home/username/run-in-focused-vm 'sleep 3 && sh -c "(exec sudo poweroff) || (exec poweroff)"' to, e.g. Ctrl + Alt + Q and make sure that your apps understand Ctrl + Q as a shutdown command (many apps do by default), then you can just shutdown VMs with open apps by making sure that the app window is in focus and then press Ctrl + Alt + Q, followed directly by Ctrl + Q, which shuts down the app gracefully and a few seconds later the VM. If multiple windows of that VM are open, make sure you Ctrl + Q on them all inside the 3 seconds.

That’s how I do it, at least.