Exiting a screen, process or application could cause a catastrophic (unrecoverable) loss of data, or a break in the session.
Present a modal dialog that delays the user from exiting immediately (the app or function is kept open in the background), informs the user of the consequences of exiting (loss of data), and requires the user to make choices, at least confirming the exit or returning to the session.