In Matt. 6:5-8, Jesus teaches that it is secret/sincere prayers that reach God’s ear and that it is such that He responds to. He warns against praying like the hypocrites who do so to win the admiration of men; who make a show of prayer, heaping volumes of vain repetitions, thinking that by so doing God will hear them (cons. Matt. 6:5,7).
Jesus instructs that when we pray, we should get into our closets and shut the door and pray to our Father Who is secret and sees in secret (Matt. 6:6, 8). Here, He is not necessarily referring to physical shutting of door. He is rather correcting the pride, and ulterior motives which the hypocrites exhibit at prayer. He instructs that we should make our prayers with a pure and sincere motive, and with a mind focussed only on God.