Changed the closing sequence to only ask for confirmation when there is
text in the document