How to prevent USD from Closing a Session with Unsaved Changes?

Found an interesting article to prevent USD from closing a session with unsaved changes.