collapsed contacts in the window switches will do this. With the windows up, unplug all of the switches and see if it still happens, if it does I would suspect the door wiring where it goes to the car or the immo (but it only operates the drivers window...).
If the window goes up and straight back down it thinks its hit an obstacle, its the safety retraction system. The guides must be tight as my learned friend says which causes the window to back off again.