This has become a common problem with the X5 and X3 which use the same Sunroof. The rails are covered in plastic to aid smooth operation but sand and other dirt get onto the runners and they break up. Without regular maintenance this is happening to 2004-2009 models. the Good news is we can replace all the worn parts with New cables & Runners for a lot less than the Dealers which can charge up to $9,000 or more to replace the whole thing. So if your Sunroof is not closing normally, the Rear Glass Rear panel is still open after the roof should have closed, this can be modified at a much cheaper option, Front can also suffer with the same problem. The Sunshade can also be a sign that the cables are in need of replacing.