Add post processing and file saving
Reset stream position after serializing
Serialize to file safely