Study of jet quenching with Z+jet correlations in PbPb and pp collisions at sqrt(s_NN) = 5.02 TeV