I am reading "Introduction to Set Theory and Topology" (in Japanese) by Kazuo Matsuzaka.
Definition:
Let $(S,\mathcal{O})$ be a topological space.
Let $x\in S$.
Let $V\subset S$.
If $x$ is an interior point of $V$, then $V$ is called a neighborhood of $x$.
Definition:
Let $(S,\mathcal{O})$ be a topological space.
Let $x\in S$.
$\mathbf{V}_S(x)$ is the set of all neighborhoods of $x$.
Problem 5 on p.223:
Let $S_1$ be a compact topological space.
Let $S_2$ be a topological space.
Let $\mathrm{pr}_2$ be a mapping from $S_1\times S_2$ to $S_2$ such that $\mathrm{pr}_2((x,y))=y$.
Prove that $\mathrm{pr}_2$ is a closed mapping.
The author's answer:
Let $A$ be a closed set in $S_1\times S_2$.
Let $B:=\mathrm{pr}_2(A)$.
We show that $S_2-B$ is an open set in $S_2$.
Let $y\in S_2-B$.
Then, $(x,y)\notin A$ for any $x\in S_1$.
Since $A$ is closed, there exist $U_x\in\mathbf{V}_{S_1}(x)$ and $V_x\in\mathbf{V}_{S_2}(y)$ such that $(U_x\times V_x)\cap A=\emptyset$.
We can assume that $U_x$ is an open set in $S_1$.
Then, $\{U_x\mid x\in S_1\}$ is an open covering of $S_1$.
Since $S_1$ is compact, there exist $x_1,\dots,x_r\in S_1$ such that $\bigcup_{i=1}^{r} U_{x_i}=S_1$.
Let $V:=\bigcap_{i=1}^{r} V_{x_i}$.
Then, $V\in\mathbf{V}_{S_2}(y)$ and obviously $(S_1\times V)\cap A=\emptyset$.
So, $V\cap B=\emptyset$ and $V\subset S_2-B$.
So, $S_2-B$ is an open set in $S_2$.
The author wrote as follows:
Since $A$ is closed, there exist $U_x\in\mathbf{V}_{S_1}(x)$ and $V_x\in\mathbf{V}_{S_2}(y)$ such that $(U_x\times V_x)\cap A=\emptyset$.
I know the following:
Since $S_1\times S_2-A$ is open, there exist an open set $U_x$ and an open set $V_x$ such that $(x,y)\in U_x\times V_x\subset S_1\times S_2-A$.
The open set $U$ which contains $x$ is a neighborhood of $x$.
So, the author is not wrong.
But why did the author write "there exist $U_x\in\mathbf{V}_{S_1}(x)$ and $V_x\in\mathbf{V}_{S_2}(y)$"?
My answer is the following:
My answer:
Let $A$ be a closed set in $S_1\times S_2$.
Let $B:=\mathrm{pr}_2(A)$.
We show that $S_2-B$ is an open set in $S_2$.
Let $y\in S_2-B$.
Then, $(x,y)\notin A$ for any $x\in S_1$.
Since $S_1\times S_2-A$ is open, there exist an open set $U_x$ and an open set $V_x$ such that $(x,y)\in U_x\times V_x\subset S_1\times S_2-A$.
Then, $\{U_x\mid x\in S_1\}$ is an open covering of $S_1$.
Since $S_1$ is compact, there exist $x_1,\dots,x_r\in S_1$ such that $\bigcup_{i=1}^{r} U_{x_i}=S_1$.
Let $V:=\bigcap_{i=1}^{r} V_{x_i}$.
Then, $y\in V$ and obviously $S_1\times V\subset S_1\times S_2-A$.
So, $V\subset S_2-B$.
So, $S_2-B$ is an open set in $S_2$.
I think the author wants to say: since $A=\overline A$ and $x\not\in A,$ $\exists$ $U_x\in\mathbf{V}_{S_1}(x)$ and $V_x\in\mathbf{V}_{S_2}(y)$ such that $(U_x\times V_x)\cap A=\emptyset$. Note you are using that since $x$ is not in the closure of A, exists a open base set $U_x\times V_x\subset S_1\times S_2$ which is neighbourhood of x which does not intersect $A=\overline A$. Your prove is also correct, to be more precise you can specify you are using the property that an open set is a neighborhood of all his points and conclude that you can find $\forall x\not \in A ,(U_x\times V_x)\subset S_1\times S_2\setminus A $ because $S_1\times S_2\setminus A$ is open since A is closed.