The closets are an ingame mechanic found in FNaC3.

NRAT in closet 2

RAT coming from the closet.

Ingame, there are three closets, which the monsters can use as an entryway and an exit to the protagonist's bedroom.

Once a monster has entered the bedroom via one of the closets, the player has to make sure, that it leaves again before it can jumpscare the player.

What the player needs to do to make the monster leave depends on the individual monster.

Once the player has scared the monster away, it will often be seen running back out of one of the closets.

But this will only make the monster disappear for ahwile and in later nights, it might return to the bedroom very quickly.