Continuity for topological spaces After reading the definition of a continuous map on general topological spaces, my question is the following:
Suppose $f$ is continuous from $\mathbb R$ to $\mathbb C$ given by $x \mapsto e^{ix}$.  Now this makes since the circle $S_1$ is closed in the ambient space $\mathbb C$ and so is $\mathbb R$. But $f$ is supposed to be continuous on any subset of $\mathbb R$ as well. Now if I restrict $f$ to $(-4\pi, 4\pi)\to \mathbb C$ given by the same mapping, I get the same closed circle, but its preimage is now not closed.   Or am I supposed to be viewing this interval with a subspace topology and considering it as the whole space, in which case the interval is both open and closed. Finally, if this is the case, am I correct in stating that a continuous function may map an open set to a closed one if the mentioned open set is also closed? 
 A: You need to distinguish between the two different functions $f:\mathbb R \to \mathbb C$ given by $f(x)=e^{ix}$ and its restriction $g=f|_{(-4\pi, 4\pi)}$. The definition of continuity is sensitive to the domain and its topology. So, both of these functions are continuous since the inverse image of an open in the codomain $\mathbb C$ is open in the topology of the domain. The domain for $f$ is $\mathbb R$, but the domain for $g$ is $(-4\pi,4\pi)$, and indeed $(-4\pi, 4\pi)$ is closed in this space.
A: Here I respond only to your final sentence:
Question: Can a continuous function map a set that is closed and open to a closed one?
Answer: Sure. Consider $f: \mathbb{R} \rightarrow \mathbb{R}$ defined by $x \mapsto 1$.
Then the closed and open set $\mathbb{R}$ is mapped to the closed set $\{1\}$.
A: Indeed, restricting the domain formally gives you a function $\tilde f: (-4\pi,4\pi) \to \Bbb C$. Then indeed $\tilde f$ will be continuous.
As to your other point, we have no control on what a continuous mapping maps things to. We only know that the preimage of any open is again open.
But even in the present case, a part of the image $S^1$ in $\Bbb C$ (say the image of an open set) will neither be open nor closed in $\Bbb C$, because it does not contain all its limit points (hence not closed), but has empty interior (hence cannot be open).
