adding new finally block in generatePDF.java