Yeah, the ending wasn't cop-out and not at all analogous to the "Emperor having a day dream" thing posted above.
Just because the filmmakers felt beholden to the source material (and maybe, contractually speaking, they were; who knows) doesn't mean the ending twist wasn't a copout.
I suspect the only way they were "contractually" obligated to do the ending from the book was by the fans of the books. If they had really changed the ending of the movie from the books the fans probably would have been furious. Many were upset enough as it is.
And, sorry, I don't see how this "twist ending" was a cop-out.