Fix closure of exported resource

This fixes https://issues.apache.org/jira/browse/PDFBOX-1586 although there will be an underlying problem which has not been inspected. Solves problem of crashes when saving split fragments from a large document,