Make backend_pgf more flexible when saving to file-handles or streams.
Merge pull request #2587 from pwuertz/fix_1625

Make backend_pgf more flexible when saving to file-handles or streams (fix #1625).