This weekend my E36 coupe has started locking itself randomly and today it locked the keys in the car! I don't have a spare so I had to smash the rear drivers window to get in

Friday morning before work, I unlocked it, pulled the handle and it locked again, twice. I had to unlock it and open the passenger door, then open the drivers door to get in. Later on it self locked whilst driving.
Today I had washed the car at a jet wash and i was drying it off, when it locked itself with the keys in it (engine off).
Typically it's now p*ssing down with rain. Help!
Does anybody know what's causing this? Boot wiring harness rubbing through? Earth problem?