It is very important to have peace of mind at the time of death. Our friends and relatives will be watching the state of our mind when we are leaving this world for good. The state of mind is affected by our joy, fear, and the circumstances under which we end our life and many other factors which have some influence on our mind.
To have peace of mind, what is needed is confidence that we are created by the Creator to be part of Him and accomplish His purpose for which He created the universe. It is not easy for each one of us to know the Creator's Purpose in creating the universe. It takes a lot of deep thinking to arrive at the Creator's thinking. Even with all our deep thinking, we may not always arrive at the correct thoughts of the Creator. However, the Creator is a being of love and all creation is a work of love. Therefore, the Creator will overlook our mistakes and short-sightedness.
When we have infinite faith that the creation was not for the purpose of having worshippers or for any other benefit of the Creator but for the Creator to have a creation to serve. This is a very encouraging thought that we are created because the Creator wanted something or someone to help. Therefore, to please the Creator, all we have to do is to receive the help He wants to give us.
When we think deeply to understand the mystery of this enterprise, we will get to know the mind of the Creator and the relationship between the Creator and the creation. The more we understand the purpose of creation, which is to have objects to serve, we can appreciate how greatly the Creator thinks of the creation and what all service He wants to render to it. When we understand this, we will be eternally indebted to the Creator for having created us. This philosophy will give us peace of mind and purpose of life. But in order to have this peace of mind, we have to think deeply and incessantly of the purpose of the creation. The more we think, the more we will be attached to the Creator and be thankful to him for creating us to render us His best service. All that the Creator wants us to do is to accept the service He wants to give us. To accept all the benefits He has programmed for us and finally, join back with Him at the end of our life to be with Him eternally
When we know this, we will not be afraid to die and we will die peacefully.