Srimad Bhagavatam Canto 02, Chapter 01, Text 13

SB 2.1.13

khatvango nama rajarsir
jñatveyattam ihayusah
muhurtat sarvam utsrjya
gatavan abhayam harim
Translation by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
The saintly King Khatvanga, after being informed that the duration of his life would be only a moment more, at once freed himself from all material activities and took shelter of the supreme safety, the Personality of Godhead.
Purport by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
A fully responsible man should always be conscious of the prime duty of the present human form of life. The activities to meet the immediate necessities of material life are not everything. One should always be alert in his duty for attainment of the best situation in the next life. Human life is meant for preparing ourselves for that prime duty. Maharaja Khatvanga is mentioned herein as a saintly king because even within the responsibility of the state management, he was not at all forgetful of the prime duty of life. Such was the case with other rajarsis (saintly kings), like Maharaja Yudhisthira and Maharaja Pariksit. They were all exemplary personalities on account of their being alert in discharging their prime duty. Maharaja Khatvanga was invited by the demigods in the higher planets to fight demons, and as a king he fought the battles to the full satisfaction of the demigods. The demigods, being fully satisfied with him, wanted to give him some benediction for material enjoyment, but Maharaja Khatvanga, being very much alert to his prime duty, inquired from the demigods about his remaining duration of life. This means that he was not as anxious to accumulate some material benediction from the demigods as he was to prepare himself for the next life. He was informed by the demigods, however, that his life would last only a moment longer. The king at once left the heavenly kingdom, which is always full of material enjoyment of the highest standard, and coming down to this earth, took ultimate shelter of the all-safe Personality of Godhead. He was successful in his great attempt and achieved liberation. This attempt, even for a moment, by the saintly king, was successful because he was always alert to his prime duty. Maharaja Pariksit was thus encouraged by the great Sukadeva Gosvami, even though he had only seven days left in his life to execute the prime duty of hearing the glories of the Lord in the form of Srimad-Bhagavatam. By the will of the Lord, Maharaja Pariksit instantly met the great Sukadeva Gosvami, and the great treasure of spiritual success left by him is nicely mentioned in the Srimad-Bhagavatam.
Srimad Bhagavatam Canto 02, Chapter 01, Text 12
Srimad Bhagavatam Canto 02, Chapter 01, Text 14