All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
First of all, we advise you to avoid being curious and asking inquisitive questions. You should refrain from investigating and searching matters, the knowledge of which does not benefit you, and the ignorance of which does not harm you.
Dear questioner, you should preoccupy yourself with what benefits you.
As regards your question, this is a matter of the unseen that can only be known through texts of revelation (Quran or Sunnah), and we have not come across any text that addresses this subject.
Among the texts that were reported about what happens to the dead before he enters the grave is the narration of Abu Sa’eed Al-khudri that the Prophet said: “When the funeral is ready (for its burial) and the people lift it on their shoulders, then if the deceased was a righteous person, it (the soul) would say, 'Take me ahead', [i.e. hasten to burry me] and if he was not a righteous one, then it would says, 'Woe to me! Where are you taking me?' His voice is heard by everything except human beings; and if they heard it, they would fall down unconscious.” [An-Nasaa’i and Ahmad]
We ask Allah to grant us a good end to our life, and not cause us to die except in a state that He is pleased with and not angry with.
Allah knows best.