Ending a film must be the hardest part of any screenwriter's task. I've seen so many films with bad endings lately. I could make a list but it would be too depressing; for instance, seeing Stardust on second run got me miffed again. Shouldn't they have crowned Una Queen of Stormhold, to demonstrate the end of misrule by fratricidal princes? And the end of 3:15 to Yuma sill leaves a bad after-taste. It's as if James Mangold had walked out in front of the camera and said, "I really don't know what this struggle between good and evil is about." A screenwriter may only be safe if he figures out the ending first and then works backward to set it up.
Barbary Coast, a minor film by Howard Hawks seems headed for tragedy in the end. The last few minutes have the hero with a bullet in him, being tended by a heroine in a fog-shrouded rowboat, with the villain in pursuit. You can feel everything in the movie heading toward the finish of Tristan and Isolde. But the movie doesn't finish there. Barbary Coast resolves is in a triptych of three-way dignity: villain, hero, and heroine all getting their respect in the finish. (Funny that Andrew Sarris himself misremembered the way Barbary Coast ended, in this book...but that was published in the days before home video and niggling little pedants on the Internet.)