No, movies don't have to have a happy ending to be great films. Most times the unhappy or uncertain endings are the much better way to go. For instance, I couldn't have seen The Mist ending any other way than what it did without ruining it. Likewise, films like The Descent, Wicker Man, Quarantine, and Dawn of the Dead (the bit after the credits) would simply not work with a happy ending. It's the tragedy that makes these films great. That being said, that doesn't mean that there's no place for a happy ending in movies, plenty of movies would likewise be destroyed by not having a happy ending of some sort.