Collective switching and heat diffusion of stacked intrinsic Josephson junctions