update / save a same xml in .Net c#
<p>I m trying to edit a xml file. After update my value, i would like to save it in same original xml file. When i attend to save into this file, i have an error "could not save into this file because it still open". Need some idea | help.</p>

<p>Thanx :)</p>

<pre><code>public void writeConfig(string withConfig, string param)
    {

        XmlTextReader reader = new XmlTextReader(pathFile);

        XElement xmlFile = XElement.Load(reader);
        reader.Close();

        var query = from c in xmlFile.Elements("config").Attributes(withConfig) select c;

        foreach (XAttribute config in query)
        {
            config.Value = param;
        }

        xmlFile.Save(pathFile);
    }
</code></pre>
