Specifically, the closed graph theorem I am referring to is:
Let $f : X \rightarrow Y$ exist and $Y$ be compact and Hausdorff. Then $f$ is continuous if and only if the graph of $f$ denoted by $G_f = \{(x,y) | f(x)=y\}$ is closed in $X \times Y$
More specifically, I am attempting to prove the "right-to-left" part of the implication which only needs compactness:
If $G_f$ is closed in $X \times Y$ and $Y$ is compact, then $f$ is continuous.
I appear to have a "proof" here that doesn't invoke compactness on Y, so what about this is invalid?
Let $x$ be arbitrary and let $V$ be an open set in $Y$ containing $f(x)$. let $U = f^{-1}(V)$.
Pick a point $(x, y)$ in $X \times Y$ such that $x \in U$ and $y \in V$ BUT $f(x) \neq y$. Note that $(x, y) \notin G_f$. Since $G_f$ is closed, it's complement is open and we can produce an open neighborhood around $(x, y)$ denoted $N=U'\times V'$ which also does not intersect $G_f$.
$U'$ is an open subset of $U$ and furthermore an open neighborhood of $x$ such that $f(U)\subset V$. Since this construction holds for any arbitrary subset of $Y$, $f$ must be continuous.
I don't appear to invoke compactness, but I'm missing what's wrong here.