Move shutdown code into main.vala and make it more like the other projects.