Mo'Ed Katan 28A
It is told that Rabbi Abi of Olinov was among the greatest admirers of Rabbi Naphtali of Ropshitz. He died on Simchat Torah in Olinov. At that time, the Hasidim in Ropshitz were dancing in their fashion before the window of their Rabbi. Rabbi Naphtali stood by the window and watched. Suddenly he raised his hand as a sign that they should stop. And he stood as if in confusion for some time. Afterward he roused himself and said, "If they go out to war and one of the captains falls, should the soldiers flee? No. The battle must go on. Rejoice and dance." Then he gave a sign that they should begin to dance. Afterward it was made known that this was the precise moment when Rabbi Abi had died.
Jewish Reflections On Death