Writes the given config object to the output stream.
The output stream to write to.
The config object to serialize.
if serialization fails.