Measurement of WZ and ZZ production in pp collisions at sqrt(s) = 8 TeV in final states with b-tagged jets