Check out my jFileWatcher library. It allows you to watch folders for creations, modifications or deletions and raises events accordingly. When I have non-UI applications that need to close gracefully (saving settings, releasing resources, etc...), I have the application create a DeleteThisFileToExitApp.txt file in File.DirApp and then watch that directory for the deletion of that file. When that file is deleted by the user, it raises a _Deleted event and you can gracefully close your app from within that event sub.
Another option I use when I have a console window open is asynchronous console input via my jColorLogger library. You can set it up so that you can type in "exit" into the console window and then your application will gracefully shut down.