Writing to a file which i just created.

Hello i have a problem, i created a directory and a file in that directory. And i want to save something to this file but i got a error:
IOException: Sharing violation on path.
This is my code:

    path_md=System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
    path_md = path_md + "/Gladiator";

    Directory.CreateDirectory(path_md);
    path_md = path_md + "/character_stats.txt";
    File.Create(path_md);

    lines = new string[3]; I declared a array above with that: public string[] lines;
    lines[0] = "dadad";
    lines[1] = "adasdasd";
    lines[2] = "adadadadadadad";

    File.WriteAllLines(path_md,lines);
    Debug.Log("after");

The folder and a file are created but i can’t write something to it:( Should i close that file or something, i just don’t know, instead of a File.WriteAllLines i tried using a StreamWrite but i got the same error:(

You should be able to use StreamWriter For that.

using(StreamWriter sw = new StreamWriter(fileName, true, System.Text.Encoding.Default))
            {

                string path_md=System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
                path_md = path_md + "/Gladiator";
                Directory.CreateDirectory(path_md);
                string [] lines = new string[3];
                lines[0] = "dadad";
                lines[1] = "adasdasd";
                lines[2] = "adadadadadadad";
                for(int i = 0; i < lines.Length; i++){
                    sw.WriteLine(lines*);*

}
Debug.Log(“after”);
}