I write to file some text after check by XmlParser. All work fine, but code, don't close that file, then i have problem latter in program with it. It create .tmp file. How close my file after that action ?
def path = new File("my/path"))
def xml = new XmlParser().parse(path)
xml.appendNode("include", [
myAppendToCheck"
])
XmlUtil.serialize(xml, path.newOutputStream())
path.newOutputStream().flush()
path.newOutputStream().close()