/// <summary>Writes the <see cref="Options"/> object to the options line in the Touchstone file. If <see cref="TouchstoneKeywords.Version"/> in
        /// <see cref="Keywords"/> is <see cref="FileVersion.Two"/>, the keywords will also be written to the file.</summary>
        /// <remarks>This method may only be called once for a file. If it is not called explicitly, the first call to <see cref="WriteData(double, NetworkParametersMatrix)"/>
        /// will implicitly call this method.</remarks>
        public void WriteHeader()
        {
            if (headerWritten)
            {
                throw new InvalidOperationException("The header can only be written once.");
            }
            core = TouchstoneWriterCore.Create(this);

            core.WriteHeader();

            headerWritten = true;
        }
        /// <summary>Asynchronously writes the <see cref="Options"/> object to the options line in the Touchstone file. If <see cref="TouchstoneKeywords.Version"/> in
        /// <see cref="Keywords"/> is <see cref="FileVersion.Two"/>, the keywords will also be written to the file.</summary>
        /// <remarks>This method may only be called once for a file. If it is not called explicitly, the first call to <see cref="WriteDataAsync(double, NetworkParametersMatrix)"/>
        /// will implicitly call this method.</remarks>
        public async Task WriteHeaderAsync()
        {
            if (headerWritten)
            {
                throw new InvalidOperationException("The header can only be written once.");
            }
            core = TouchstoneWriterCore.Create(this);

            await core.WriteHeaderAsync();

            headerWritten = true;
            headerWritten = true;
        }