Artificial intelligent assistant

Let $f: X \rightarrow X$ be a homeomorphism of a compact metric space. If the orbit of $x$ is compact, then $x$ is periodic Let $f: X \rightarrow X$ be a homeomorphism of a compact, connected metric space. If the orbit of $x$ is compact, then $x$ is periodic. I feel like should be trivial, but I cannot seem to work out a proof. Since $f(Orb(x)) = Orb(x)$ and $Orb(x)$ is minimal, it follows that $Orb(x)$ is nowhere dense.

Assuming that the orbits are two-sided orbits consider the orbit $Y$ of $x$. This is a countable compact metric space and $f$ is a homeomorphism of $Y$ onto itself. Write $Y$ as the union of its singletons and apply BCT to conclude that some point in $Y$ is open. This implies that each point of $Y$ is open because $f$ is a homeomorphism. Compactness of $Y$ implies that $Y$ is a finite set. [Look at the open cover formed by singletons].

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 453b01924ba6e4d809fae9df094e1b59