The Catholic Church teaches that purgatory is a final stage of purification for many souls desiring to enter the gates of Heaven. It is called by some the "washroom" of Heaven, where souls go who want to "clean themselves up" before entering total union with God for all eternity.
The Church encourages us to pray for these souls, believing our prayers can somehow shorten the time spent in this stage of purification.
Here is a prayer from the Raccolta that directs our prayers to that soul who is closest to Heaven and is on the verge of entering eternal bliss.