Do quotienting and contraction commute? $\DeclareMathOperator{\Spec}{Spec}$

Let $A \subset B$ be an integral extension of rings. Consider the map $f:\Spec B \to \Spec A$ by $f(Q) = Q^c = Q \cap A$. Show that $f$ is a closed map.

My idea was to consider a typical closed set $V(I)$ of $\Spec B$ and show that $f[V(I)] = V(I^c)$.
The inclusion $(\subset)$ was easy to show. It is the reverse direction that I am struggling with.
Here's what I have done: Consider $P \in V(I^c)$. Thus, $P \in \Spec A$ and $P \supset I^c$.
Note that the extension $A/I^c \hookrightarrow B/I$ is integral and $P/I^c$ is a prime in $A/I^c$.
Then, by the lying over theorem, it follows that there exists a prime $Q/I \in \Spec(B/I)$ contracting to $P/I^c$.
Thus, we have gotten hold of a prime ideal $Q \in V(I).$ I am now not sure how to prove that $Q \cap A = P$. (Is this even true?)

An alternate approach could have been to directly use the lying over theorem for $P$ to conclude that there exists a prime $Q \in \Spec B$ lying over $P$. But then it wasn't clear why $Q \supset I$.
 A: Recall that the inclusion $i : R/I^c \hookrightarrow S/I$ is given as $i(r + I^c) = r + I$. Regarding $R/I^c$ as a subset of $S/I$ under this map, we show that $$(Q/I) \cap (R/I^c) = (Q \cap R)/I^c.$$
(You already know that the left set is $P/I^c$.) Note that $Q \cap R$ indeed contains $I^c = I \cap R.$
$(\subset)$ Let $x \in (Q/I) \cap (R/I^c)$. Then $x = r + I^c = q + I$ for some $r \in R$ and $q \in Q$. However, we identify $r + I^c$ with $r + I$ in $S/I$. Thus, we see that $r + I = q + I$ in $S/I$ and thus, $r - q \in I \subset Q$.
Thus, we see that $r \in q + Q = Q$. Since $r \in R$ to begin with, we conclude that $r \in Q \cap R$ and thus, $x = r + I^c \in (Q \cap R)/I^c$.
$(\supset)$ Let $x \in (Q \cap R)/I^c$.
Then, $x = y + I^c$ for some $y \in Q \cap R$. Under the identification, we have $$x = y + I^c = y + I.$$
The second expression shows that $x \in R/I^c$ and the third that $x \in Q/I$.
Conclusion. The main issue here is getting around the (abuse of) notation and then concluding that $$P/I^c = (Q/I) \cap (R/I^c) = (Q \cap R)/I^c.$$
Now, $P$ and $Q \cap R$ are ideals containing $I^c$. By the ideal correspondence, we see that $P = Q \cap R$.
