foomatic-rip: Fix a SIGPIPE error when calling gs (#517)
https://autopkgtest.ubuntu.com/packages/f/foo2zjs/lunar/ppc64el shows
foo2zjs's testsuite failing with cups-filters 2.0beta3 on ppc64el because
the gs command here to check page count is failing with a SIGPIPE when
trying to write back to the parent. To fix this, we close gs's input fd as
soon as we know we're done writing to it. Since gs may not have started
processing its input until this happens, also give the final poll() a longer
timeout (5s instead of 1s); without this we see race conditions because
foomatic-rip gives up before gs has had a chance to finish processing.