Hi Thys,
The browse and the form have a "Generate" routine. ie GenerateBrowse and GenerateForm respectively.
These will run once, but there are no guarantees that they won't run more than once.
there are no embed points guaranteed to run when a form or browse is closed, because the user can "close" them in any number of ways. Closing the browser, turning off the machine, just walking away (and letting the session expire), as well as choosing a menu item, typing something into the URL, pressing the BACK button, and so on.
Perhaps you should ask the question with a hint of what you are trying to do.
cheers
Bruce