Doors can keep a cat from wandering outside, but many cats dislike doors when they lock them out of different rooms in your house. As soon as you shut a door, cats immediately want to know what’s on the other side. Thus they often glare at doors for blocking them access to the rest of the house.
Since cats are curious (and bossy), they may never rest until they get past the door. Then as soon as you let them into one room, they’ll immediately want to leave and go to another room. As anyone with a cat can tell you, cats are not the most logical or rational beings around so get used to their odd behavior as part of the price you pay for having a cat.