Fixed small bug that could lead to an xml file not being fully exported.