Fix memory leaks in pdf-filter code.

We were never freeing the top level filter_gstate, and we were losing
a reference to each new resource type dictionary when we create them.
Fix potential leak of pdf_process state.

In the event that an annot is hidden or invisible, the pdf_process
would never be freed. Solve that here.

Thanks to Simon for spotting this!