Multipage pdf with statement

This makes it possible to use the with statement with multipage pdf, so that it gets closed automatically.