save tree in file