Let $f:X\rightarrow Y$ be a flat morphism of normal projective varieties with fibers of positive dimension (in particular all the fibers are connected and of the same dimension).

Let $g:X\rightarrow Z$ be another morphism with connected fibers of positive dimension. Assume that $g$ contracts the general fiber of $f$ to a point of $Z$. Is it true that then $g$ must contract any fiber of $f$ to a point of $Z$?

In other words, is the map

$$Y\rightarrow \mathbb{Z},\: y\mapsto dim(g(f^{-1}(y)))$$

continuous?