At the very end right before he loses his balance he collects all Palpatine's energy and throws it back at him. I really believe if Yoda hadn't fallen because of the kickback that he was about to defeat Palpatine.