Motors are probably working fine (one each side), but circuit detects too much current being drawn - taking too much effort if you will - to open / close. The motors current limit when not yet opened/closed and believe they've hit an obstruction (like your head!) and then either reverse or stop (it stops if the current in the reverse direction is equally excessive, rather than just cycling back and forth) so as not to cause any harm. You'll want to identify what's binding up, get that resolved, and reset the open position per the manual. This is covered in your owner's manual. Look for the pages related to the liftgate, specifically for "Automatic reversal" and "How to reset the power liftgate".