fix the leave() logic in document viewer, and add it to the confirm screen