Closing the door, is not just to shut things or people out.. Mathew 6:6
If we look at the context of the whole chapter, we can clearly see that closing the door, is about separating ourselves from people for a time being, not because we want our prayer not to be heart by other people, or to cut out distraction, but so that other people will not have any relation to our prayer.
Our prayer is between us and God, so when we close the door, there is only one opportunity left, our prayer to be heart from God and nobody else, so that other people can not hear us praying.
Jesus was referring about some people, praying with the main purpose to be heart from people, not from God.
That is why he said that we should close the door, so that we can pray and be heard from God only, and nobody else.
Jesus said that we should pray to be heard from heaven, and not be heard from the earth, and those who live on it..