If $Y$ is compact and $f : X \rightarrow Y$ is a map whose graph $G = \{ (x,f(x) : x \in X\}$ is closed in $X \times Y$ , then $f$ is continuous.
Let $C \subseteq Y$ be a closed. Let $x \in X - f^{-1}(C)$. We want to show that there is an open neighborhood $U$ of $x$ in $X - f^{-1}(C)$.
For each $c \in C$, that there is an open neighborhood $U_c \times V_c$ of $(x,c) \in (X \times Y)-G$, since the graph is closed. Since $Y$ is compact, a finite number of the $V_c$ cover $C$. Denote them as $V_{c_1}, ... , V_{c_N}$ for some $N \in \Bbb{N}$. We claim that $\bigcap_{i=1}^N U_i$ is an open neighborhood of $x \in X - f^{-1}(C)$.
Suppose, for contradiction, that we have $f^{-1}(c) \in \bigcap_{i=1}^N U_i$ for some $c \in C$. We know that $c \in V_i$ for some $1 \leq i \leq N$. Since $f^{-1}(c) \in \bigcap_{i=1}^N U_i$, $f^{-1}(c) \in U_i \implies (f^{-1}(c), c) \in U_i \times V_i$ contradicting the fact that $U_i \times V_i \subseteq (X \times Y) - G$.
Is my answer correct?