How to stop an application for a self-update?

You can split your application into 2 parts: main application and updater. You can call the updater from the main app (and stop the main app), do all the update stuff, then relaunch the main app from the updater.