Close file resources when saving and loading XML