A gate that will not close may have photo-eye, safety edge, loop detector, limit, obstruction, or operator problems.
Look for obvious obstructions, dirty photo-eyes, loose wires, damaged rollers, and anything blocking the gate path. Avoid bypassing safety devices.
If the gate keeps reversing, will not close, or has safety device faults, call a qualified gate technician.