updates jade2pdf function to wait for pdf to finish writing before reading