Ask confirmation before exiting when there are pending changes

Ask for confirmation before logging out when there are pending changes in the session.