I have to check the CBA to be sure, but I do NOT believe the Wings will get all 6 million off the books. Rafalski is retiring with a contract through this up coming season. I believe that the remaining amount is spread out against the cap over a period of 3 years (may just be 2 though). Thus, they may only get 4 million off the books (or maybe just 3 million, depending on the terms)
And, good luck finding a GM stupid enough to take Hudler and his 2.75 million contract off our hands.
Pretty sure you get it all back if the contract was signed prior to the player turning 35.