/// <summary>
        /// Closes the writer and the underlying stream.
        /// </summary>
        public void Close()
        {
            if (tarStream != null)
            {
#if NETSTANDARD13
                tarStream.Dispose();
#else
                tarStream.Close();
#endif
                Dispose();
            }
        }