Why didn’t King Asa finish well?

King Asa started out so well… In the line of David, king of Judah, tore down the high places, deposed his evil grandma, faced up to the army from Cush with Divine help…What went wrong in his old age? Instead of depending on God (like he had his whole life before) he depended on the temple treasury and an alliance with an enemy (Ben Hadad). When he had nothing, he depended on God. When he was old and had gold and silver, he depended on wealth.
Are we tempted like this too? I want to finish well. How can we finish well?