This problem illustrates that $d\theta$ is a particularly misleading and hence poor notation for this $1$-form: It isn't the exterior derivative of anything!
(More generally the common notation $dV$ for a volume form on an oriented manifold suffers the same issue. For this reason I prefer a slightly more verbose notation like $\operatorname{vol}$ for a volume form.)
This notation also makes the provided proof possibly confusing. Here's a bit more detail:
If $\omega = df$ for some differentiable (and hence continuous) function $f$, then in particular that equality holds on the slit plane $$S := \Bbb R^2 \setminus L , \qquad L := \{(x, 0) \in \Bbb R^2 : x \geq 0\} ,$$
where in particular we can define the usual coordinates $(r, \theta) : S \to (0, \infty) \times (0, 2 \pi)$, so that
$$df \vert_S = \omega\vert_S = d\theta .$$
(The mentioned abuse of notation $d\theta$ makes a sidebar important here: In the preceding equation, $d\theta$ is the exterior derivative of the function $\theta$, and hence is defined only $S$; written there it is not the form $\omega$, but rather its restriction to $S$.)
So, on $S$ we have
$$0 = df\vert_S - d\theta = d(f\vert_S - \theta) ,$$ and in particular (since $S$ is connected) $f\vert_S - \theta$ is some constant function $C$, that is, as claimed, $$f\vert_S = \theta + C .$$
On the other hand, $f\vert_S$ cannot be the restriction of a continuous function $f$ on $\Bbb R^2 - \{(0, 0)\}$: At any point $(x, 0)$, $x > 0$, in the slit, the limit of $f$ at that point as you approach from above the $x$-axis is $C$, but the limit from below is $C + 2 \pi$, so $\lim_{p \to (x, 0)} f$ does not exist, hence $f$ is not continuous there, a contradiction.
A much faster proof is available once you have access to integration: By Stokes' Theorem (in this case, the Fundamental Theorem of Line Integrals, essentially), if $\omega$ were an exact form, then we would have $\int_\gamma \omega = 0$ for any curve $\gamma$. But parameterizing a convenient closed anticlockwise curve that encloses the origin once---say, the unit circle---and computing directly gives $\int_\gamma \omega = 2 \pi$, a contradiction.