gitignore certificates and tmp folder
Remove temp file after document is printed

- refactor printing functions into closure
Ensure deletion of tmp file by deferring deletion before printing