Fix saving to in-memory file-like objects in Postscript backend

This is a follow on to #2498.  (I tried to make a PR against @megies branch, but github won't let me for some reason).

This opened up a whole can of worms, exacerbated by the fact that there are 3 of these file-like objects all with subtley different behavior, and we want to support all of them.