properly quit app

also tiny cleanup