For those who believe you may only be saved before your death, and not after, there are two Biblical verses that may apply.
Jesus answered, Verily, verily, I say unto thee, Except a man be born of water and of the Spirit, he cannot enter into the kingdom of God. John 3:5
The Catholic Church mentions this in the first footnote "60", but expands the meaning of "born of water and Spirit" to include water, blood, desire, God's way, and God's mercy.
Water baptism, blood baptism, desire baptism, God's way, and God's mercy
VI. THE NECESSITY OF BAPTISM
1257 The Lord himself affirms that Baptism is necessary for salvation.60 [quoted above] He also commands his disciples to proclaim the Gospel to all nations and to baptize them.61 Baptism is necessary for salvation for those to whom the Gospel has been proclaimed and who have had the possibility of asking for this sacrament.62 The Church does not know of any means other than Baptism that assures entry into eternal beatitude; this is why she takes care not to neglect the mission she has received from the Lord to see that all who can be baptized are "reborn of water and the Spirit." God has bound salvation to the sacrament of Baptism, but he himself is not bound by his sacraments.
1258 The Church has always held the firm conviction that those who suffer death for the sake of the faith without having received Baptism are baptized by their death for and with Christ. This Baptism of blood, like the desire for Baptism, brings about the fruits of Baptism without being a sacrament.
1259 For catechumens who die before their Baptism, their explicit desire to receive it, together with repentance for their sins, and charity, assures them the salvation that they were not able to receive through the sacrament.
1260 "Since Christ died for all, and since all men are in fact called to one and the same destiny, which is divine, we must hold that the Holy Spirit offers to all the possibility of being made partakers, in a way known to God, of the Paschal mystery."63 Every man who is ignorant of the Gospel of Christ and of his Church, but seeks the truth and does the will of God in accordance with his understanding of it, can be saved. It may be supposed that such persons would have desired Baptism explicitly if they had known its necessity.
1261 As regards children who have died without Baptism, the Church can only entrust them to the mercy of God, as she does in her funeral rites for them. Indeed, the great mercy of God who desires that all men should be saved, and Jesus' tenderness toward children which caused him to say: "Let the children come to me, do not hinder them,"64 allow us to hope that there is a way of salvation for children who have died without Baptism. All the more urgent is the Church's call not to prevent little children coming to Christ through the gift of holy Baptism.
CCC -source- (emphasis mine)
Another Biblical verse that suggests one must believe when alive, before dying, is this.
And as it is appointed unto men once to die, but after this the judgment: Heb 9:27
Apparently you die, then are judged as to your salvation.
So, to answer the OP, the Biblical basis to only be saved prior to your death is the necessity to be born again of water and Spirit, and the verse about dying and then judgment.
PS. Why can't you be baptized after death?
Now this I say, brethren, that flesh and blood cannot inherit the kingdom of God; neither doth corruption inherit incorruption. 1 Cor 15:50
What exactly would be baptized? You will have some type of body, but is it baptizable? Or has the point been missed, which is to say it is your spirit that is born-again.
Yet, the verse remains that one dies, and one is judged (Heb 9:27).