As Canny said, you should not save each time through your loop--you're doing too much work that way. But what's causing your problem is the Remove inside the loop--see
http://msdn.microsoft.com/en-us/library/system.xml.linq.xnode.remove.aspx[
^]
If removing is all you're doing, you don't need to loop, just remove:
string pathname = @"d:\itemsnew.xml";
var xdoc = XDocument.Load(pathname);
xdoc.XPathSelectElements("/items/superitem/item[@id!='2']").Remove();
xdoc.Save(pathname);
If you are doing more inside the loop, then convert your element enumeration to a list using ToList, as the MS link describes.