Some believe that if Adolph Hitler had confessed his sins to Christ and accepted the Savior, the world's most notorious madman would have gone to heaven. However, while many Christians would reject Hitler being saved, others would agree that Joe Shmoe can wait until the moment of death before accepting Christ. "If the Thief on the Cross could wait until the last minute to get into heaven, why can't we?"
You are on a very slippery slope by waiting until the last minute. Most of us don't know when we'll die. The bible tells us, "God is not mocked...a person will reap what they sow." (Galations 6:7) In other words, you will get what you deserve. A heart who deliberately rejects the Goods News of salvation, thinking that they will have the best of both worlds, will reap only God's wrath.
Salvation involves trusting in Christ, changing your ways (repentance), confession, and water baptism. (See article here.)
God can do what He wants within the parameters of His eternal grace and mercy. But one cannot live a lifetime of evil, thinking that God will wink and smile at it, just because a priest performs a ritual prior to or even after death.