Hide alert before creating PDF

NOTE: Previously, the PDF was being created before the alert was dismissed.
      This resulted in several extra unnecessary layers (belonging to the alert
      window) to be added to the PDF.