I have an 07 wagon and it could be a variety of things. The opening memory could need to be reset. Simply open/close it and help it open to where it should.
If the motor works here and there, it could be on the way out. I think the motor is in the roof (IIRC) so I'm sure you can unplug it but not sure if you can still open/close it manually.
It could be one of the three switches (door, close switch on the hatch or the open switch above the license plate).
My switch above the plate failed (2000km out of warranty) ). It would open and close randomly unless you could lock it. I had to disconnect that switch inside the hatch, but it would open via the door switch, key fob and close via the close button. I replaced the grab rail (as it's called) and I'm back in business. Not sure if that helps or clouds things. LOL