pdf: Fix dispose implementation

Dispose must be safe against multiple runs, so set pointers to NULL
after freeing them.
5 jobs for wip/chpe/fix-dispose in 4 minutes and 31 seconds (queued for 3 seconds)