Fix crash from freeing root xml node before file