libgimpconfig: add gimp_config_serialize_to_stream()

and gimp_config_writer_new_stream() which take a GOutputStream. Also
fix some new and old corner cases in GimpConfigWriter.
app: add a GOutputStream* parameter to GimpData::save()

Open/close the stream generically in GimpData. Improves error handling
and simplifies the save() functions.