I am not familiar with using event handlers, and I was wondering if anyone had or could direct me to some code that shows how to use an event handler that will execute code
Josh Smith's article on MVVM has a nice example of ViewModels that are part of a workspace and what to do on close. This architecture can be expanded beyond just your window being closed, but cleaning up ViewModels, etc.
Josh Smith MVVM example
In Figure 7 he describes the situation you are talking about. Hope this helps!