I'm reading Baby Rudin and exercise 28 of chapter 2 reads "Prove that every closed set in a separable metric space is the union of a (possibly empty) perfect set and a set which is at most countable." I don't understand why the set must be closed in order for this to be true. My proof is as follows, and I don't make any reference to the closedness of the set:
Let $E$ be a set in a separable metric space. Let $B$ be a countable base of that metric space. Let $P$ be the set of condensation points of $E$. I claim that $P$ is perfect and $E-P$ is at most countable.
If $p$ is a limit point of $P$, then every neighborhood of $p$ includes at least one point $q$ of P. For a neighborhood $N_{p}$ of $p$, choose a neighborhood $N_{q} \subset N_{p}$ of $q$. Since $q$ is a condensation point of $E$, uncountably many points of $E$ are in $N_{q}$, and thus in $N_{p}$. So $p\in P$ and $P$ is closed.
If $p \in P$, then $p$ is a condensation point of $E$, so every neighborhood $N_{p}$ of $p$ must include uncountably many points of $E$. If $p$ is not a limit point of $P$, then there exists a neighborhood $N_{p}$ of $p$ such that $N_p$ includes no condensation points of $E$ except for $p$. This means that every point $q\in N_{p}-\{p\}$ must have a neighborhood $N_{q}$ that does not have uncountably many points of $E$. For each $b_{k}\in B \cap \mathscr{P}(N_{p})$, choose such a neighborhood $N_{q_{k}} \supset b_{k}$ of some point $q\in N_{p}-\{p\}$. Now $\{N_{q_{k}}\}$ covers $N_{p}$, and $\bigcup_{k=1}^{\infty}N_{q_{k}}\supset N_{p}$ has at most countably many points of $E$, for it is a union of countably many sets that have at most countably many points of $E$. This contradicts the assumption that $p\in P$. So $P$ is perfect.
Let $S=E-P$. There are no condensation points in $S$. So there exists an open cover $\{N_s\}$, where each $N_s$ is a neighborhood of $s \in S$ with at most countably many elements of $S$. For each $b_{k}\in B \cap \mathscr{P}(S)$, choose such a neighborhood $N_{s_{k}} \supset b_{k}$ of some point $s\in S$. Then we have a countable subcover $\{N_{p_{k}}\}$ of $S$. As $N_{p_{k}} \cap S$ is at most countable for all $k$, $S$ must be at most countable.
So what am I doing wrong? Or is Rudin's assumption of closedness extraneous?