don't use `shell=True` in PDF export
wait for subprocess to finish
Merge pull request #3 from ivanov/noshellpdf

wait for subprocess to finish
Merge pull request #3877 from minrk/noshellpdf

don't use `shell=True` in PDF export

and wait for the subprocess to finish.