Having trouble with XML Write on Air application

[COLOR=#000000][FONT=verdana]I am working on an air application where i need to overwrite an existing XML on the disk. I used FileStream to overwrite the file. But for some reason the XML is not over written. Below is my code. Please guide me on this.[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]************************************************[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]//generatedXML is the XML generated by the application[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]var XMLPath:String = “xml/settings.xml”;[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]var XMLFile:File = File.applicationStorageDirectory.resolvePath(XMLPa th);[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]var XMLFileStream:FileStream = new FileStream();[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]trace("generatedXML: "+generatedXML); //shows generated XML perfectly[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]try[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]{[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]XMLFileStream.openAsync(XMLFile, FileMode.WRITE);[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]XMLFileStream.writeUTFBytes(generatedXML);[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]}[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]catch(e:Error)[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]{[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]Alert.show("Error: "+e.message); // doesnt show any errors here[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]}[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]finally[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]{[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]XMLFileStream.close(); [/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]}[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]************************************************[/FONT][/COLOR]