Dynamic phase transition of black holes in massive gravity