This question has been asked before, but I am stuck on a different part. If $\phi: X \rightarrow Y$ is a morphism of varieties over an algebraically closed field $k$, I'm trying to understand why $\phi(X)$ contains a nonempty open subset of its closure. Here a variety is a ringed space of $k$-algebras which has a finite open cover by maximal spectra of reduced finitely generated $k$-algebras.
I understand the proof when $X$ and $Y$ are affine, $X$ is irreducible, and $\phi(X)$ is dense in $Y$. What I'm having trouble understanding is how we can reduce to that case. In (1.9.5), Springer Linear Algebraic Groups, the proof says we first reduce to the case where $Y$ is affine, then to the case where $X$ is affine, then to the case where $X$ is irreducible.
Reducing to the case where $Y$ is affine:
I'm trying to understand first how we can reduce to the case where $Y$ is affine. I suppose we should start with finite affine open cover $W_i$ of $Y$, and let $U_i = \phi^{-1}W_i$. Then $\phi$ restricts to a morphism of varieties $U_i \rightarrow W_i$. The closure of $\phi(U_i)$ in $W_i$ is $\overline{\phi(U_i)} \cap W_i$. Suppose for each $i$ with $U_i \neq \emptyset$, we have shown that $\phi(U_i)$ contains a nonempty open subset $V_i$ of $\overline{\phi(U_i)} \cap W_i$. That intersection itself is open in $\overline{\phi(U_i)}$. Hence $V_i$ is open in $\overline{\phi(U_i)}$. I want to say that the union of $V_i$ is open in the union of the $\overline{\phi(U_i)}$, which is $\overline{\phi(X)}$. But in general if $A_1$ is open in $B_1$, and $A_2$ is open in $B_2$, then $A_1 \cup A_2$ need not be open in $B_1 \cup B_2$. Even if $B_1$ and $B_2$ are closed in some larger space.
You need an open affine cover of $\overline{\phi(X)}$, not of $Y$. So the trick is to assume without loss of generality from the beginning that $\phi(X)$ is dense in $Y$. Then $\phi(X) \cap W_i$ is dense in $W_i$. Now let $U_i = \phi^{-1}(W_i)$. The claim is that $$\overline{\phi(U_i)} \cap W_i = W_i$$ Once this is proved, we are done, because the $V_i$ will then be open in $Y$. We have $\phi(U_i) = \phi(X) \cap W_i$, so the closure of $\phi(U_i)$ in $W_i$, i.e. $\overline{\phi(U_i)} \cap W_i$, is the closure of $\phi(X) \cap W_i$ in $W_i$. But $\phi(X) \cap W_i$ is dense in $W_i$, so this closure is $W_i$.