Berry phase from a quantum Zeno effect