The method that I use is to not allow the user to close the window (turn off the "Allow User to Close Window" in the "Window Appearance" VI property). I then put some kind of "Quit" button on the panel of the VI. I can them program what I want that button to do.
If I want the "Quit" button to function as an "Abort" button and kill whatever is happening when it is pressed, I run it in its own while loop outside of the rest of the program. LabVIEW then runs the check of the button in its own thread.