Resolve issue where config would become corrupted

When creating the write stream, ensure that any existingfile is
overwritten, so that the end config files do not become merged if the
one being written is shorter than the current one.