Serialize writes to the underlying stream