Sets whether to write the default root element. Must be called before the first element is written, otherwise an exception is thrown.