Ok I worked on it a little more with the help of a programmer friend and we figured out a better way. Ignore the solution in the first post.
1. Find your exported project's package.nw file and open it (it can be opened as a zip archive, you can even rename it to a .zip file if you remember to change it back after).
2. Open up the index.html file inside that archive.
3. Paste this code right before the last closing </script> tag:
var win = window['nwgui'].Window.get();
win.on('close', function () {
window['nwgui'].App.quit();
});
4. Save the new index.html file and the changed package.nw.
5. Test out your game to see if all processes close fully upon exit.