We can also use the fact that a function $g:\mathbb R^n \to [-\infty,\infty]$ is closed if and only if all of its sublevel sets are closed.
If $\alpha > 0$ then \begin{align*} \\{ x \in \textbf{dom } f\mid f(x) \leq \alpha \\} &= \\{x \in \mathbb R| \frac{1}{x} \leq \alpha \text{ and } x > 0 \\} \\\ &= \\{ x \in \mathbb R \mid \frac{1}{\alpha} \leq x \\} \end{align*} which is closed. Moreover, if $\alpha \leq 0$, then the sublevel set $\\{ f \leq \alpha \\}$ is empty.
This shows that all the sublevel sets of $f$ are closed, so $f$ is closed.