Fixes a problem with unclosed streams

The streams don't get closed during processing and so stay open and thus cause the test ReplicationTest/testPushReplicationCanMissDocs to fail on Windows but more general mean that anytime, anyone ever uses multi-part (which is used, for example, by the pusher) then the streams will be locked forever and attachment cleanup isn't possible.