I just discovered that Shavarevich (second edition) has a wrong answer to this question. In Section I.6.3, after Theorem 7 (which is correct), he gives the following Corollary. This quotation combines the Theorem and the Corollary.

Let $f: X \to Y$ be a regular map between irreducible varieties. Suppose that $f$ is **surjective** ... The sets $Y_k := \{ y \in Y: \dim f^{-1}(y) \geq k \}$ are closed in $Y$.

Note that this differs from the true EGA IV 13.1.5 by replacing "proper" with "surjective". I figured I'd record a counterexample here, which is slightly more public than just creating a handout for my class.

Our map is a composition $X \subset \mathbb{A}^3 \to \mathbb{A}^3 \to Y \subset \mathbb{A}^4$. We'll call the two $\mathbb{A}^3$'s $A$ and $B$ respectively.

$X$ is the quasi-affine variety $A \setminus \{ (0,\ast,0) \}$. We map $A \to B$ by $(x,y,z) \mapsto (x, xy, z)$. We map the $B$ to $\mathbb{A}^4$ by $(p,q,r) \mapsto (p(p-1), p^2(p-1), q,r)$. $Y$ is the affine variety $\{ (a,b,c,d) : a^3 = b(b-a) \}$. In other words, $Y$ is the product of a nodal cubic with $\mathbb{A}^2$.

To see surjectivity, note that $X$ hits every point of $B$ where $p$ is nonzero. The points of $B$ where $p \neq 0$ map to the points of $Y$ where $(a,b) \neq (0,0)$. The points $(0,0,c,d)$ in $Y$ are the images of $(1,c,d) \in B$, which are in turn the images of $(1,c,d)$ in $X$.

Now, let's look at $\dim f^{-1}(0,0,0,r)$. When $r \neq 0$, this is the union of $(1,0,r)$ and $(0, \ast, r)$, so one dimensional. When $r = 0$, the line $(0, \ast, 0)$ is deleted, so the preimage is only a point.

This suggests that something nicer may happen if we insist that fibers are irreducible, or that $Y$ is normal (perhaps Zariski's Main Theorem gets involved?) but I don't have a proposed statement to make.