Make your own homemade gate latch.
“The picture gives the shape of a latch which [does not allow the gate to swing open]. When screwed to the gate post, the latch will be found to swing in position to secure the gate, and the greatest weight of the latch is beneath the screw pivot.”