not all instances of app.exe close when app quits

Ok, I am not a Windows developer normally so the issues is probably PEBAC.

I have an app called notes.exe that launches a main window that then launches (creates instsances of a document windows) documents. Each document is its own window. When I close the mainwindow, it closes all the documents/document windows. But when I look at the task list, I still see an instance (or more) of notes.exe although there are no windows ans noting in the task bar.

and of course the app wont start again until either I reboot or kill off the notes.exe in the task manager.

So what am I doing wrong? could it be I have a thread running on the document windows that I am not implicitly stopping?


Perhaps this is not working as it should.

This seems plausible.