They say that good things come to those who wait. When it comes to certain films, that idiom is sometimes stretched to breaking point as overly dutiful film fans are forced to sit through a couple of hours of garbage only for the ending to be confusingly brilliant.
It would be tempting to say that a great ending can wash away everything that came before it and transform a film's reception entirely (simply because the finale always leaves a lasting mark), but that's only really true of films that are at least mediocre. In those cases, a good conclusion can indeed atone for the sins that came before it, but it's more complex when a film is flat-out terrible before it comes up with a strange, out of place Hail Mary ending.
For those movies, the great endings are frustrating proof of what could have been; reminders that everyone involved actually isn't as terrifyingly inept as the previous couple of hours seemed to suggest. They might go some way to restoring a little faith, but just as eating a delicious dessert after a meal of crap won't quite wash away the taste, it's often way too little, way too late.
Sometimes, it genuinely is worth waiting to the very end before you walk out of bad movies...