If the door is opening upwards (against gravity) & downwards (with gravity) then, just like you or me, the motor has an easier time closing than opening.
You may get away with separate motor-on & motor-off timings which you can find by trial & error, at least for a few cycles of open/close. But even that will drift over time with other factors coming in to play, like wind, or whether the birds get to ride the gate as it moves.
For best results, as Mahjong says, employ a switch at the limit of the door's travel (open or closed, whichever has a hard mechanical stop which would otherwise strain the motor if left running). That way on each opening/closing cycle, the door will be sync'd to a known reference point.
Roller-switches are usually used in these limit-switching applications. They are usually fitted with a soft spring & a roller to minimize the activation force & any friction as the surfaces come together.