and he was drawing a contrast with those who made a show of their prayers as both Jesus and his disciples prayed in public. His disciples were not to do as the hypocrites.
Jesus didn't violate his own precepts.
The KJV calls it a closet. Whatever he meant by it he specifically said "close the door". He calls on the disciples (and believers) to pray in private. He is saying there is no reason whatsoever to pray in public, and if you think about it it makes perfect sense, because otherwise people may think you are doing it for hypocritical reasons, and probably are.
Jesus message is loud and clear as a bell: Instead of making a spectacle of one's worship, do it in private. So why are Christians making a public spectacle with their prayers on TV and at sporting events, and every other occasion? Is that not hypocritical? Is that not contrary to what their own God told them not to do?