...Even the most pious of Christians can screw up from time to time and die directly thereafter with sin on their soul...
Not exactly. If that individual is a true follower of Christ, he/she would have made peace with God before dying and would ask for and receive Forgiveness through God's Promise of Forgiveness.
True followers of Christ become Children of God through the Born-Again intervention of The Holy Spirit residing in his/her life. They are still human and reside in "sinful flesh" but now have the spiritual strength and guidance from God to repent and turn away from the things that are not pleasing to God.
It is by the degree of submitting to the guidance of God that one has more strength or less strength to resist any type of temptation. However, if and when a Child of God "screws up" he/she becomes convicted by the Holy Spirit and is led to immediately seek forgiveness from God for the offense and ask forgiveness of those who may have been offended.
You are right, no person is perfect but a true follower of Christ is going to hate the wayward ways that break fellowship with God and seek to repent and get back on track.
As the Bible states:
If we say that we have no sin, we deceive ourselves, and the truth is not in us.
If we confess our sins, he is faithful and just to forgive us our sins, and to cleanse us from all unrighteousness.
If we say that we have not sinned, we make him a liar, and his word is not in us. (1 John 1:8-10)
Becoming “Born-Again” is what seals a person’s Salvation
That we should be to the praise of his glory, who first trusted in Christ.
In whom ye also trusted, after that ye heard the word of truth, the gospel of your salvation: in whom also after that ye believed, ye were sealed with that holy Spirit of promise,
Which is the earnest of our inheritance until the redemption of the purchased possession, unto the praise of his glory. (Ephesians 1:12-14)