"Open" and "closed" are not absolute terms, they are relative terms. A subset of a set is "open" with respect to a particular topology, and "closed" with respect to a particular topology.
The real numbers have lots of topologies you can place on them. However, there is one topology which is used most often, namely, the "standard topology". This is the topology that arises from the metric, which makes a subset $\mathscr{O}\subseteq\mathbb{R}$ open if and only if for every $x\in \mathscr{O}$ there exists $\epsilon\gt 0$ such that
$$B(x,\epsilon) = \{r\in\mathbb{R}\mid |r-x|\lt\epsilon\} \subseteq \mathscr{O}.$$
When one asks if a subset of $\mathbb{R}$ is "open" or "closed" and does not specify a topology for $\mathbb{R}$, it is assumed that one is talking about the standard topology of $\mathbb{R}$, the one described above.
So your question is not asking "Can you come up with a topology on $\{a\}$ that makes it open or closed?" (The answer to that question is always "yes", no matter what the set you are looking at is). The question you are asking is really:
Is the set $\{a\}$ closed but not open as a subset of $\mathbb{R}$, in the standard topology?
So, use the definition of "open" for the standard topology to see whether $\mathbb{R}-\{a\}$ is open (that will tell you whether the set is closed in the standard topology); and use the definition of "open" for the standard topology to see whether $\{a\}$ is open.
Every space is both open and closed in itself. Of course, $X:=(0,1)\cup(2,3)$ is open and not closed in the real line.
Now, it's clear that both $(0,1)$ and $(2,3)$ are open in the real line, so open in $X$ in the subspace topology. Since $(0,1)=X\setminus(2,3)$, then $(0,1)$ is closed in $X$. Likewise, $(2,3)$ is closed in $X$.
Best Answer
No, the only sets that are both open and closed in $\mathbb{R}^n$ in the standard topology are the empty set and $\mathbb{R}^n$ itself.
A topological space $X$ is said to be disconnected if there exist two nonempty open sets $U,V \subset X$ so that $U \cup V = X$ and $U \cap V = \emptyset$. A topological space is connected if it is not disconnected. Informally speaking a disconnected space can be broken into open "pieces." But you see immediately that if $U$ is open and $V$ is its complement, $V$ is both open and closed, as is $U$. So an equivalent definition is that a connected space has no nontrivial open and closed subsets.
Now, one can show that intervals in $\mathbb{R}$ are connected. This requires a proof, but it's intuitively believable as the intervals come only in one "piece," so to speak. It's also true that the finite Cartesian product of connected sets are connected. From this it follows that $\mathbb{R}^n$ is connected. In particular, it has only the trivial clopen (both open and closed) sets $\emptyset$ and $\mathbb{R}^n$.