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
Merge pull request #3720 from biggert/localpdfmanager-undefined

Prevent undefined error when calling .destroy on a document when LocalPdfManager is used