Good beginning and Bad endings

Some athletes who changed the track during the race have been disqualified. Many have lost their opportunities to win medals, even when they finished first. There are a few characters, who stumbled at the last.

Asa
King Asa was the third king of the Kingdom of Judah. He generally did good and what was right in the eyes of God and was fully committed to the Lord. (I Kings 15:10; II Chronicles 15:17) Sadly, in the thirty-fifth year of his reign did a few blunders. To counter King Baasha of Israel, Asa made a treaty with Ben-Hadad, king of Aram. (I Kings 15:16-22; II Chronicles 16:1-10) Hanani the prophet warned him, but Asa did not repent; oppressed more people. He got a severe foot disease and did not seek God, but only the physicians.

Jehoshaphat
Ahab the wicked king of Israel. His marriage alliance was worst, that his son Jehoram did not follow him. Jehoram when he took power, killed all his brothers. (II Chronicles 21:4-6) Ahab invited Jehoshaphat to join him in the war. The prophets gave a promise of victory. However, Jehoshaphat discerned, it was false and had Micaiah summoned, who warned of defeat and death. Yet, Jehoshaphat joined Ahab in the war and died. (I Kings 22:15-18)

Josiah
Josiah was a good king but blundered in the last phase of his life. Pharoah Neco wanted to fight against Babylonians at Carchemish but should pass through Judah. Josiah opposed Necor. However, Neco clarified that he is not coming to fight against him. Josiah did not consult the Urim and Thummim or ask a prophet. Josiah was mortally wounded and later died at the age of 39. (II Chronicles 35:25; II Kings 23:25).

Uzziah
He came to rule when he was sixteen years old and ruled for 52 years between 792 to 740 B.C. (II Chronicles 26) He was a strong and good king, but he became proud and tried to offer incense in the temple, which was opposed by the priests. God afflicted him, and he died as a leper, losing his kingship.

Do I preserve until the end to be saved? (Matthew 24:13)