In The Lion, The Witch, and the Wardrobe author C.S. Lewis makes five references to the characters making sure to not latch the wardrobe from the inside:
[Lucy] immediately stepped into the wardrobe […], leaving the door open, of course, because she knew that it is very foolish to shut oneself into any wardrobe. [Chapter 1]
[Lucy] had, of course, left the door open, for she knew that it is a very silly thing to shut oneself into a wardrobe. [Chapter 1]
[Lucy] did not shut [the door] properly because she knew that it is very silly to shut oneself into a wardrobe, even if it is not a magic one. [Chapter 3]
[Edmund] jumped in and shut the door, forgetting what a very foolish thing this is to do. [Chapter 3]
Peter held the door closed but did not shut it; for, of course, he remembered, as every sensible person does, that you should never never shut yourself up in a wardrobe. [Chapter 5]
This is mentioned enough times that it seems to be more than a passing bit of advice, although I imagine at least one purpose was to discourage any impressionable young readers from getting trapped and suffocating inside a wardrobe in their own imaginative attempts to reach Narnia. Is there any other known reason for harping on this rule?