The following question appeared on my topology exam. I couldn't solve it then, and now I am trying it once again.
Could someone check my proof to see if it is correct, or maybe suggest an easier way?
Let $(X,\mathcal{T})$ a topological Hausdorff space.
Let $p\not\in X$ and define $\widehat{X}=X\cup\{p\}$ with the topology $\widehat{\mathcal{T}}$ (you may assume that this indeed defines a topology):
$$U\in\widehat{\mathcal{T}}\iff\begin{cases}p\in U \text{ and }X\setminus U\text{ is a compact subset of }X,\text{ or} \\ p\not\in U\text{ and }U\in\mathcal{T}. \end{cases}$$
Prove that $\widehat{X}$ is compact.
I drew a picture, where the red space is $X$ and the green circles are the open sets in the covering.
My approach:
Let $\{A_\alpha \}_{\alpha\in I}$ an open covering of $\widehat{X}$.
Let $J\subset I$ such that $p\in A_\alpha\iff \alpha\in J$. Take an $\alpha'\in J$. We know that $X\setminus A_{\alpha'}$ is a compact subset of $X$.
For all $\beta\in J$, $X\setminus A_\beta$ is compact. Since $X$ is Hausdorff, we now that $X\setminus A_\beta$ is closed, so $A_\beta\cap X$ ($=A_\beta\setminus\{p\}$) is open in $X$.
Now $\{A_\beta\setminus\{p\} \}_{\beta\in J}\cup \{A_\gamma \}_{\gamma\in I\setminus J}$ is an open covering of $X$ using open sets in $X$, so it also covers $X\setminus A_{\alpha'}$.
This implies that there exist $M\subset J$ and $N\subset I\setminus J$ finite such that $\{A_\beta\setminus\{p\} \}_{\beta\in M}\cup \{A_\gamma \}_{\gamma\in N}$ covers $X\setminus A_{\alpha'}$, or that
$$\{A_\alpha\}_{\alpha\in\{\alpha' \}\cup M\cup N}$$
is a finite subcovering of $\{A_\alpha \}_{\alpha\in I}$ of $\widehat{X}$.

The subspace topology $X$ inherits from $\widehat X$ is the same as the original topology on $X:$
$\ U\in \tau_X\Rightarrow U\in \tau_{\widehat X}$, by definition. On the other hand, if $p\in U\in \tau_{\widehat X},\ $ then $X\cap U=X\setminus (X\setminus U)$ is open in $X$ because $X\setminus U$ is compact hence closed in $X$ (because $X$ is Hausdorff).
So, $\{X\cap A_{\alpha}\}_{\alpha\in I}$ is an open cover of $X$, hence of $X\setminus A_{\alpha'}.$ Therefore, there are integers $\{1,\cdots, n\}$ such that $\{X\cap A_{\alpha_i}\}^n_{i=1}$ covers $X\setminus A_{\alpha'}$ which implies that $\{A_{\alpha_1},\cdots, A_{\alpha_1}, A_{\alpha'}\}$ covers $\widehat X.$