[guided]Recall that $h:X\to\mathbb{C}$ is the holomorphic function $h=f-g$, and that $Z\subset X$ is the set of points at which $h$ vanishes on some open neighbourhood. We need to prove that a limit point of $Z$ also belongs to $Z$. The definition of $Z$ is stronger than pointwise vanishing: a point belongs to $Z$ only when $h$ vanishes on some whole neighbourhood of that point. Thus, starting with $x\in\overline{Z}$, we must produce an open neighbourhood of $x$ on which $h$ vanishes.
Choose a complex coordinate chart $(W,\varphi)$ around $x$, where
\begin{align*}
\varphi:W\to\varphi(W)\subset\mathbb{C}^n
\end{align*}
is a homeomorphism onto an open subset of $\mathbb{C}^n$. We want the coordinate domain to be connected, because the local identity theorem for holomorphic functions propagates vanishing across connected domains. Since $\varphi(W)$ is open and contains $\varphi(x)$, there exists $r>0$ such that the open Euclidean ball
\begin{align*}
B(\varphi(x),r):=\{z\in\mathbb{C}^n:|z-\varphi(x)|<r\}
\end{align*}
is contained in $\varphi(W)$. Define
\begin{align*}
V=\varphi^{-1}(B(\varphi(x),r)).
\end{align*}
Then $V$ is an open neighbourhood of $x$ in $X$. It is connected because the ball $B(\varphi(x),r)$ is connected and $\varphi|_V:V\to B(\varphi(x),r)$ is a homeomorphism.
Since $x\in\overline{Z}$, every open neighbourhood of $x$ meets $Z$. Applying this to the open neighbourhood $V$, choose a point $y\in V\cap Z$. By the definition of $Z$, there exists an open neighbourhood $N_y\subset X$ of $y$ such that $h|_{N_y}=0$. Hence $h$ vanishes on the nonempty open subset $N_y\cap V$ of $V$.
Now translate this statement into coordinates. Define the coordinate representative $H:B(\varphi(x),r)\to\mathbb{C}$ by
\begin{align*}
H(z)=h(\varphi^{-1}(z)).
\end{align*}
Because $h:X\to\mathbb{C}$ is holomorphic and $(W,\varphi)$ is a holomorphic coordinate chart, the coordinate representative $H$ is holomorphic on $B(\varphi(x),r)$. The set $B(\varphi(x),r)$ is connected, and $H$ vanishes on the nonempty open subset $\varphi(N_y\cap V)$. Therefore the Identity Theorem for Holomorphic Functions of Several Complex Variables applies and gives
\begin{align*}
H(z)=0
\end{align*}
for every $z\in B(\varphi(x),r)$.
Returning from coordinates, this means $h=0$ on $V$. Since $V$ is an open neighbourhood of $x$, the definition of $Z$ gives $x\in Z$. We have shown every point of $\overline{Z}$ lies in $Z$, so $Z$ is closed.[/guided]