2002 Subaru Outback

My automatic door locks started locking and unlocking by itself while I was driving. Then when I parked a couple blocks away I could not lock the car using the button on the door, I had to use the remote to lock it. What could it be?