I would say that when the gates were installed they didn't meet correctly and that there was some method of adjusting them ... it could be something like a screw with a locking nut ... at a guess I would say that the gates were not forced but the adjustment has become loose.
I suggest you switch the power off while you look for an adjustment hole or a small plate to remove to expose a mechanism ... with the power off be confident to look at the internal mechanism ... it could be a microswitch. It will be something which will switch off the motor used to close the gate.
If you go looking inside with the power on you may well loose a finger or two as the forces involved will be large.
It is one thing to look but it is another thing to do.
Note - I don't really know but am suggesting a way forward for you.
Nyge
April 2011