7/8/14: added a method to attempt to close the pdf after every error.