You did a great job of using a psychological advantage to achieve the desired result; get the guy gone.
I'm a confrontational sort of person, and would most likely have done something other than go inside when I realized that the guy was waiting beside my house. Not sure if I would have asked him if he needed help (you know, in a manner that seemed concerned and helpful), or invited him to leave using a more aggressive approach.
Either one has more of a possibility of ending badly for someone.
Door between you and bad guy + psychological advantage = best possible outcome (bad guy gone with no physical interaction).