Take a look in the example finder at the Events example called Dynamically Monitor VI's.vi it demonstrates how to capture the event of a user closing your program. So if they close it using the X in the top corner, it will capture this as an event, and you deal with it as you please. There was another thread about this very recently, I looked briefly for it but couldn't find it, maybe someone could link it for you if they find it.
Jeff
Using Labview 7 Express