The works of Ādi Śaṅkarācārya

Bṛhadāraṇyakopaniṣadbhāṣyam

Verse 240

तद्यथा तृणजलायुका तृणस्यान्तं ग-त्वान्यमाक्रममाक्रम्यात्मानमुपसँहरत्ये-वमेवायमात्मेदँ शरीरं निहत्याविद्यां

In plain words

Picture a leech on a blade of grass: it reaches the very tip, stretches out and takes hold of the next blade, then pulls the rest of itself in. That is exactly what you are doing at death — letting this body go, releasing the ignorance bound up with it...

Close to the Sanskrit

It is thus: as the grass-leech, having gone to the end of the grass, having stepped onto another foothold, draws itself in — so indeed does this self, having struck down this body, [and, having dispelled] ignorance...