This happened to me as well and thankfully my wife was home with the spare and ran on over to unlock. I'd suggest setting the door code (if you have one) as that was the first thing I did when i got back.
I'm not sure if this is a setting you can turn off but I'd ask your local dealer if so. I had a toyota prius before hand and if the keys were in or near by the car door wouldn't lock itself. I don't like the feature but i have that keypad so now i'm "ok" with it.