I too encountered this, and got whacked in the head by my 2020 Outback. We took it into the dealer and the service guy showed us an easy fix for this.
The problem is due to the liftgate opening too far, causing it to think it has hit an obstruction, and then closing back up . The fix is to reset the stop point on the liftgate.
Here's the procedure the service guy showed us to do this:
1. Find the two liftgate buttons near your left knee when sitting in the driver's seat. The one closer to your knee has the word 'Off' on it.
2. Make sure this 'Off' button is depressed.
3. Get out and go to the back of the car.
4. Open the liftgate with the liftgate button.
5. Let it open all the way and do its beeps and start coming back down.
6. Firmly stop it with your hand. It may require some fighting, but it will eventually give up.
7. Manually move it to the height where you want it. Don't set the height all the way back up to the stop point, because that's what may be causing the problem in the first place. Try opening it all the way up, and then bring it back down just a little bit.
8. Press and hold the button on the liftgate until the car beeps a few times and the rear lights flash. The new liftgate opening height should now be programmed.
9. Test it out: close the liftgate and then open it back up.
10. If all is good, press the liftgate ‘Off’ button from step 2 again, so it is no longer depressed.
NOTE: I went out and tried these steps again just now, and I didn’t need to do steps 1, 2, and 10. I was able to program the liftgate height whether the liftgate ‘Off’ button was depressed or not.
Regardless, Subaru needs to make this a high priority fix. Automatic features are great, but they must not do harm. If the liftgate is going to auto-close due to an obstruction real or perceived, it should do it slowly and only back off a few inches.