Hi Bill,
In general, this is not too easy to do. You can add data validation to your fields so that when the user clicks the X it will prompt them to fix the errors before closing, but I can't think of much else you can do without going Full Trust. You might play around in the _Shutdown() method that InfoPath generates for a new managed code form project.
I hope this helps, please let us know what you come up with!
Matt Faus / Microsoft InfoPath MVPQdabra® Software / Streamline data gathering to turn process into knowledge