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