Some battles end badly. We all want to finish well, but the truth is we can't possibly do that. We are destined for failure, it's in our corrupted nature. Many of the Heros of the Bible, didn't finish well. Samson, Solomon, even David didn't end without some major setbacks. But it's not over, the END hasn't happened yet. In the END all those in Christ, finish well, praising God around His throne forever. Doing what we were designed to do well. The corruption of sin has been defeated and we get to experience the awesome, pure, divine relationship with God we at our core desire. That is a good ending, but its a happy ending that never ends!
Success in this life doesn't secure a good ending, only faith in Jesus Christ does that! With this end in mind, keep following Jesus. Die to your self and live for Him.