Exercise: Let $f:(X,\tau)\to (Y,\tau_1)$ be a continuous bijection. If $(X,\tau)$ is compact and $(Y,\tau_1)$ is Hausdorff, prove that $f$ is a homeomorphism.
I tried to prove this on the following way:
First I proved the following Lemma:
Lemma: If $(X,\tau)$ and $(Y,\tau_1) $are compact Hausdorff spaces and $f:(X,\tau)\to(Y,\tau_1)$ is a continuous mapping then $f$ is a closed mapping.
Proof: If $A\subset X$ is compact than it is closed in $(X,\tau)$. Then if $\{a_n:n\in\mathbb{N}\}$ is an arbitrary sequence in A then by the compactness there is a subsequence that converges in A such that $\lim_{n\to\infty}a_{in}=a$ where $a \in A$. By continuity of $f$, $\lim_{n\to\infty} f(a_{in})=f(a)$ so that $f(a)\in f(A)$. So $f(A)$ is compact since the space $(Y,\tau_1)$ is compact then $f(A)$ is closed. So $f$ is a closed mapping.
In the Exercise the function is continuous so if $B\in\tau_1$ then $f^{-1}(B)\in\tau$, now it is left to show that $f$ send open sets to open sets. This is where my problem begins:
Compactness is going to be preserved by continuity of $f$, then $(Y,\tau_1)$ must be compact as every image of a subset of $(X,\tau)$ that would imply that $f$ is a closed mapping by the Lemma. If $C$ is a closed set in $X,\tau$ then $f(X\setminus C)=X\setminus f(C)$ which must be open. However I am not certain about this last step.
Question:
How should I solve the question? Is my proof right?
Thanks in advance!