This was a symbolic gesture of something that would take place in the near future on Pentecost. By this, He emphasized that neither peace with God nor working for God can be accomplished without the work of God's Spirit. It is through His Spirit that God changes hearts to believe, to be reconciled with God, and to carry the message of salvation to all the world. By giving them the commission to preach the gospel, Jesus gave them the keys of heaven. For people who believed the gospel, they unlocked the gates of heaven, and for those who rejected the gospel, they closed the gates of heaven.
Choices have consequences.
The church cannot admit people to or expel them from God's kingdom as they like. The keys of the kingdom are carried by the church but handled by God Himself. Initial rejection of the gospel does not close heaven forever. Paul persecuted the church at first, but was later changed by the Spirit into an important instrument in God's hand. Thomas was one of the original Twelve and one of the present Eleven.