Let $f: X \longrightarrow{Y}$ a continuous surjective and closed function between topological spaces such that $f^{-1}(y)$ it is compact for all $y \in Y$. Prove that $Y$ is compact if and only if $X$ is compact
My attempt:
If $X$ is compact then for every collection $C$ of open subsets of $X$ we have:
$\displaystyle\bigcup_{x \in C}^{}{X }$
Thanks