iTunes started out as a third-party playlist manager whose name escapes me (I even owned a copy). It's perfectly possible that it included licensed code that couldn't be open-sourced even if Apple wanted to do so.
Next, Apple was only able to negotiate licensing deals for music (and later video) content from the various rights holders after agreeing to various strictures including sufficently restrictive DRM and functional restrictions such as allowing music to be copied only from computer to iPod and not from multiple computers to a single iPod.
Apple didn't try to stop third parties from working around some of these restrictions but it couldn't be seen to be allowing them to be circumvented willy-nilly and open-sourcing iTunes would immediately lead to a "rip everything to MP3" and "grab everything from all attached devices" features.
Next, Apple was only able to negotiate licensing deals for music (and later video) content from the various rights holders after agreeing to various strictures including sufficently restrictive DRM and functional restrictions such as allowing music to be copied only from computer to iPod and not from multiple computers to a single iPod.
Apple didn't try to stop third parties from working around some of these restrictions but it couldn't be seen to be allowing them to be circumvented willy-nilly and open-sourcing iTunes would immediately lead to a "rip everything to MP3" and "grab everything from all attached devices" features.