One of the desert fathers relates the following beneficial story:
In Thessaloniki, there was once a convent of virgins. One of the nuns by virtue of the works of the tempter, left the monastery and fell to prostitution. She remained in this loathsome sin of immorality for a number of years. Yet after some time, with the help of God, Who loves mankind, she repented and returned to her convent. But before she was able to enter into the convent, she fell dead at the gates.
In the meantime, her death was revealed to a certain holy man. In this revelatory vision, he saw – amongst other things – both the Holy Angels who had come to take her soul and the demons following behind the soul. On the one hand, the Angels claimed the nun had returned to the convent repentant, and thus her soul belonged to them. But the demons answered: “She has worked so many years for us, and therefore her soul should be ours. Moreover, she did not even manage to enter into the convent. How, then, can you claim that she repented?”
The Angels, however, cut them off, saying that from the moment that God, Who is omniscient, perceived that the nun’s intention was aimed at repentance, He gladly received her and she was justified. “She was master over her repentance, in reaching the goal which she had intended; the Lord over her life, however, is the Master of all.”
After hearing these words, the demons were thwarted and departed, leaving the soul to the Angels.
Evergetinos, Vol. 1, Hypothesis 1(E) pg. 12