I am struggling with the idea that all compact subsets of a metric space are closed after reading chapter 2 of Rudin's Principles of Mathematical Analysis.
The reason I am confused is that it seems unreasonable that a compact subset must be closed. If we were to take an open subset $K$ of a compact subset $Y$ in a metric space $X$, where $K$ is open relative to $X$, then every finite subcover of $Y$ would also be a finite subcover of $K$. But then, $K$ would be both compact and open in $X$, which contradicts the theorem that all compact subsets in $X$ are closed.
Could someone please explain to me why my reasoning is incorrect and how it is that compact subsets of metric spaces must be closed?