I attempt to create an XML file using the code below, I want to create an element insert data, close element and start another element. When I try to start the second element I am getting an error message

How do I create separate elements?

"System.InvalidOperationException was unhandled
Message="Token StartElement in state Epilog would result in an invalid XML document."
Source="System.Xml"
StackTrace:
at System.Xml.XmlTextWriter.AutoComplete(Token token) at System.Xml.XmlTextWriter.WriteStartElement(String prefix, String localName, String ns) at System.Xml.XmlWriter.WriteStartElement(String localName) at WindowsApplication1.Form1.WriteXml(String pFileName) in C:\Example\WindowsApplication1\WindowsApplication1\Form1.vb:line 61 at WindowsApplication1.Form1.Button1_Click(Object sender, EventArgs e) in C:\Example\WindowsApplication1\WindowsApplication1\Form1.vb:line 11 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(ApplicationContext context) at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()
InnerException:


Code:
 Public Sub WriteXml(ByVal pFileName As String)
        Dim fs As FileStream
        Dim tw As XmlTextWriter
        Dim sw As StringWriter
        fs = New FileStream(pFileName, FileMode.Open, FileAccess.Read)

        sw = New StringWriter()

        tw = New XmlTextWriter(pFileName & ".xml", _
        New System.Text.UTF8Encoding())

        tw.Formatting = Formatting.Indented
        tw.Indentation = 4

        ' Write out the header information
        tw.WriteStartDocument()
        tw.WriteComment("Produced from " & pFileName & " on " & Now.ToString)

        tw.WriteStartElement("Name")
        tw.WriteString("txtName")
        tw.WriteEndElement()

        tw.WriteStartElement("Address")
        tw.WriteString("txtAddress")
        tw.WriteEndElement()
        tw.WriteEndDocument()

        tw.Flush()
        tw.Close()


        

    End Sub