It flows from the events which Jesus spoke about in Matthew 24.
Jesus had warned the Jews of his generation about an invasion by the Roman army. He had spoken about the abomination that causes the desolations.
Luke gives an account of this.
And when ye shall see Jerusalem compassed with armies, then know that the desolation thereof is nigh.
Then let them which are in Judaea flee to the mountains; and let them which are in the midst of it depart out; and let not them that are in the countries enter thereinto.
If you know you history Titus the Roman general dispatch to conquer Jerusalem, laid siege in Jerusalem before destroying the same.
He had to do so because he could not penetrate the already built walls of Jerusalem.
The parable is about leaving Jerusalem before the siege happens. Those who did not heed the warnings of Jesus were caught in the siege and could not leave Jerusalem.
They were caught in the tribulation and were eventually destroyed and burnt alive.
The door that closed is referring to the siege. It’s not about failing to make heaven. It’s about leaving Jerusalem.
It’s not about the Holy Spirit leaving you. He never leaves. Never forsakes you.
May you find comfort in one of the most confusing preached parable of all time.