Yes, with an "invoke node", see
this recent thread.
In your case, you would placen it inside the stop event, or outside the main loop. Ensure that it executes as last step, (either with data dependency or a sequence frame or similar).
If you use events, you can make it even happen if the user closes the VI by clicking on the big X.