Measurement of the Z gamma production cross section in pp collisions at 8 TeV and search for anomalous triple gauge boson couplings