I am writing the proof that locally closed immersions are of finite type but I am stuck at minor detail. I would like that either (1) preimages of open affines by open immersions be quasicompact or (2) that given an affine $Spec\, A$ in the source of a closed immersion it would be possible to find an affine in the target whose preimage is exactly $Spec \, A$.
Here is why:
To show that the locally closed immersion $Z\overset{\rho}{\rightarrow} W\overset{\tau}{\rightarrow} X$ is of finite type, where $\rho$ is closed and $\tau$ is open, by definition, we must show that for any open affine $Spec\,C$ in the target and open affine $Spec\,A$ in the preimage the induced map of structure sheaves $(\tau\rho)^\#:C\rightarrow A$ makes $A$ into a finitely generated $C$-algebra.
Now, what I need is to get my hands on an open affine $Spec\,B \subset \tau^{-1}(Spec\,C)$ such that $\rho^{-1} (Spec\, B) = Spec\, A$. If this were true, then it would follow trivially from $A\rightarrow B$ being a surjection that $A$ is a finitely generated $B$-algebra. Since $Spec\,B$ is quasicompact, we would be able to cover it by finitely many distinguished open sets $D(f_i)$ such that $\tau (\bigcup D(f_i)) = \bigcup D(\tau^\# (f_i)) = A_{\prod f_i}\Rightarrow B=A_{\prod f_i}$, so that $A$ is clearly a finitely generated $C$ algebra.
But how do fill the gap in my argument?