There is a magical art to closing one's mind to intrusion. We call it Occlumency. There are two branches: emptying one's mind completely, similar to meditation, and only hiding certain parts of one's mind, which is meant to give the illusion that you're easily accessible. The latter is far more difficult to master for obvious reasons. I only ever knew two people who could do it successfully.