The Vedanta Sutras of Badarayana, Commentary by Sankara (SBE38), tr. by George Thibaut  at sacred-texts.com
12. Up to death (meditations have to be repeated); for then also it is thus seen in scripture.
The first adhikarana (of the present adhyâya) has established that repetition is to be observed with regard to all meditations. But now a distinction is made. Those meditations which aim at complete knowledge, terminate--in the same way as the beating of the rice grains is terminated by the husks becoming detached from the grains--with their effect being accomplished; for as soon as the effect, i.e. perfect knowledge, has been obtained, no further effort can be commanded since scriptural instruction does not apply to him who knows that Brahman--which is not the object of injunction--constitutes his Self. On the other hand a doubt arises whether the devotee is to repeat those meditations which aim at certain forms of
exaltation for a certain time only and then may stop; or whether he is to repeat them again and again as long as he lives.
Here the pûrvapakshin maintains that such meditations are to be carried on for some time only and then to be given up, since this satisfies the demands of those scriptural passages which teach meditations distinguished by repetition.
To this we make the following reply. The devotee is to reiterate those meditations up to his death, since the supersensuous result (of such meditations) is reached by means of the extreme meditation. For such works also as originate a fruit to be enjoyed in a future state of existence presuppose, at the time of death, a creative cognition analogous to the fruit to be produced; as appears from such passages as, 'Endowed with knowledge (i.e. the conception of the fruit to be obtained) he (i.e. the individual soul) goes after that (viz. the fruit) which is connected with that knowledge' (Bri. Up. IV, 4, 2); 'Whatever his thought (at the time of death), with that he goes into Prâna, and the Prâna united with light, together with the individual Self, leads on to the world as conceived (at the moment of death)' (Pr. Up. IV, 2, 10). This also follows from the comparison to the caterpillar (Bri. Up. IV, 4, 3). But the meditations under discussion do not, at the time of death, require any other creative cognition but a repetition of themselves. Such meditations therefore as consist in the creative conception of a fruit to be obtained must be repeated up to the moment of death. Analogously the scriptural text, Sat. Brâ. X, 6, 3, 1--'With whatever thought he passes away from this world'--declares that the meditation extends up to the time of death. Similarly Smriti says, 'Remembering whatever form of being he in the end leaves this body, into that same form he ever passes, assimilated to its being' (Bha. Gîtâ VIII, 6); and 'At the time of death with unmoved mind' (Bha. Gîtâ VIII, 10). And that at the moment of death also there remains something to be done, the scriptural passage (Kh. Up. III, 17. 6) also proves. 'Let a man, at the time of death, take refuge with this triad.'