This are few Definitions stated in Principles of Mathematical Analysis by Walter Rudin:
Now, Consider the interval (1,2).
This interval is closed because according to $(b)$ the every point of this set contains another point in its neighbourhood, thus a limit point, hence closed.
Open at the same time according to the $(e), (f)$ given in the definition.
Please clarify.
There is a difference between
and
You have reasoned that $(2)$ is true and concluded that $E$ is closed. But this is incorrect, because you need to check whether $(1)$ is true, since $E$ is defined to be closed if $(1)$ holds.
And indeed, $1$ is a limit point of $E = (1,2)$ but $1 \not\in E$, so $E$ is not closed.