Fix |cleanup| regression in the viewer

Addresses https://github.com/mozilla/pdf.js/issues/2813#issuecomment-57545936 by mimicking the pattern used in https://github.com/mozilla/pdf.js/blob/master/web/thumbnail_view.js#L370.