Fix static preview error due to missing PDF

While converting the input code to PNG image for static preview,
MathB\Preview is deleting the intermediate PDF too early, after
running the pandoc command to convert the input code to PDF.
Therefore, when the convert command runs to convert the PDF to
PNG, it fails. Fix this by moving the code to delete the PDF
after the convert command converts the PDF to PNG.