Trying to fix #3611
Merge pull request #3729 from prometheansacrifice/page-outofbounds

Trying to fix #3611
Prevent undefined error on null object when calling .destroy on a
document initialized with LocalPdfManager.

Per @brendandahl's recommendation, moved the terminate function out of worker
and into the PdfManager