As it locks then unlocks, one of the lock sensors faulty, Or.I would 1st check the connector units, door to frame, plug and socket type quite often. unplug them, from behind the rubber boot covering them, check the connections any signs of corrosion etc, thats possibly the problem, try contact cleaner/lubricant spray. Worked on my back door, which would not unlock at all.
SD
January 2012