I don’t think he’s done it purposely to ensure they don’t get a penny for them. I do believe he’s probably had some poor advice, with his reps full well knowing Madrid’s interest in him.
I also don’t think the boos are because he’s leaving on a free, it’s because he’s “one of their own” and they fully thought he’d be a one club man.