Added automatic compression at each serialization.
Don't flush the file if it's temporary.
Updated CMakeLists.