It shouldn’t be too difficult to keep your pet cat out of a closet. Just close the door, and your cat’s lack of opposable thumbs should do the rest.
Of course, if your cat has a strange talent for opening doors without using their handles, you’re in trouble.
This particular cat found an unexpected route into the closet: wriggling its paws under the door until it swung open. The best part is the thoroughly confused dog watching this all unfold.
https://www.youtube.com/watch?v=5s8x8RqGPLY
Screengrab via Silky Tofu/YouTube