Fix issue #862: Do not compress data in memory but directly to file.

All basic and library tests which passed before are still passing.