Cleaned up the code

- removed the hardcoded 30 for the number of pages
- added a cleanup after the pdf files are merged