For SharePoint List forms the SPI object has an OnCancel() event. This event is ONLY called when the user clicks cancel when in Edit Mode. Unfortunately this event is not called when the user just closes the form/screen either by selecting the 'X' in the upper right of the form or by clicking away from the form. It would be most helpful if either the OnCancel() even could be called when the form is closed or an OnClose() event is added. I have tried using the OnHidden() for the screen, but that is not consistently called when the form is closed.
Having consistent ways to start and end a user session is important since the variables withing a power app are not reset between form uses if the browser is not refreshed. Being able to detect how the Power App is used will allow for a more consistent user experience regardless of how they chose to close or end their last session.