Entanglement in a periodic quench