Are bounded level curves of a continuous function $f(x,y)$ closed? Let's say I consider all the points $(x,y)$ such that $f(x,y) = c$ for some $c$, given $f$ continuous, and let's assume the set of this points is bounded. Now consider any of the connected components of this set. I get the impression that the only way for a connected component not to be a closed curve (closed in the sense of curves, not in the sense of sets) is for the values $f(x,y)$ to be local extrema. Is this right? If not, can anyone come up with an example of a continuous function that has a bounded non closed level curve, which is not comprised of local extrema? If yes, does the answer extend to higher dimensions? (e.g., closed surfaces for a continuous function $f(x,y,z)$)
 A: If $f$ is a continuous function, the set
$$\Pi_c=\{(x,y): f(x,y)=c\} = f^{-1}(c) $$
is closed as the inverse image of a closed set (a point of the real line) through a continuous function. Of course it is not always a closed curve: the set
$$\left\{(x,y): \frac{1}{(x-2)^2+y^2+1}+\frac{1}{(x+2)^2+y^2+1}=\frac{2}{3}\right\} $$
is given by the union of two disjoint almost-circles, for instance:
$\hspace1in$
A: Complete rewrite.
Note that for any topologically closed set $S$ in the plane there is a continuous function $g$ such that $S$ is the zero set of $S$.  One example of such a function is $g(x,y)=\operatorname{dist}((x,y),S)$.  Here is an example of a set $S$ of a sort you have probably not considered, built up out of the Cantor set $K$,   as described in (say) the wikipedia article, together with a more interesting function $f$. 
Recall the Cantor set $K$ is a topologically closed subset of $[0,1]$ obtained by removing the union of certain disjoint open intervals.  In particular, $K=[0,1]\setminus \bigcup_{n\ge1}C_n$ where $C_n$ is the disjoint union of $2^{n-1}$ particular open intervals of length $3^{-n}$ each, the precise specification of which is spelled out in the wikipedia article and in textbooks. The $C_n$ themselves are disjoint. Define a function $h$ of a real variable by
$$h(x) = \begin{cases}0&\text{ if } x\in K\\
\operatorname{dist}(x,K)&\text{ if } x\notin[0,1]\\
(-1)^n\operatorname{dist}(x,K)&\text{ if } x\in C_n.\end{cases}.$$
This function is continuous, has no local maxima or minima on $K$, and has $K$ as its set of zeros. (It is a bit like $x\mapsto x\sin(1/x)$ which does not have a local maximum or minimum at $x=0$.  Each point in $K$ is very near points in $C_n$ for $n$ sufficiently large for both even and odd $n$, for which $h$ takes on positive and negative values.)
Let $S=(K\times[0,1])\cup([0,1]\times K)\subset\mathbb R^2$, and note that $S$ is the zero set of the continuous function $f(x,y)=h(x)h(y)\operatorname{dist}((x,y),[0,1]\times[0,1])$.  $S$ is topologically connected, topologically closed, bounded, and no point in $S$ is a local maximum or minimum of $f$.  I do not know if $S$ is a curve according to your lights, but is does not look at all like the ones in highschool geometry books, or in Jack's answer.
A: If $f:\mathbb{R}^2 \to \mathbb{R}$ is smooth and proper, you are indeed correct (also with regards to the extension to higher dimensions. The proper is there only to guarantee that it is "closed" and doesn't "go away to infinity"). This is due to the regular value theorem  (in the link, it is called "Submersion theorem").
Particularly, in the case of $f:\mathbb{R}^2 \to \mathbb{R}$, your interpretation as "closed curves" is quite accurate due to the classification of $1$-manifolds without boundary: all connected components must be diffeomorphic to circles.
Now, with less technicality (but, of course, less precise statement):
If $f$ is sufficiently well-behaved and the level curve is bounded (recalling that we are under the condition that $f$ does not assume a local extrema for any point in its level curve), then it will be a disjoint union of closed curves.
If you require only continuity, the result is false (as exposed by @kimchi lover's answer).
A: In the comments you ask if a letter $X$ could be one of these connected components. Yes, it can. Define $X= [-1,1]\times \{0\} \cup \{0\}\times [-1,1].$ For $x\in \mathbb R^2,$ define
$$f(x) = \begin{cases} d(x,X)\sin (1/d(x,X)) & x\notin X \\0 & x\in X.\end{cases}$$
Here $d$ is the usual euclidean distance function. Then $f$ is continuous on $\mathbb R^2.$ The level set $f = 0$ is the disjoint union of the curves $ \{d(x,X) = 1/(n\pi)\}, n = 1,2,\dots,$ together with $X.$ Thus $X$ is a connected component of $f = 0.$
Note that $f<0$ in $ \{1/(2\pi)< d(x,X)<1/\pi \},$ $f>0$ in $ \{1/(3\pi)< d(x,X)<1/(2\pi \},$ etc. It follows that in any neighborhood of a point of $X,$ $f$ will take on both positive and negative values. Since $f=0$ on $X,$ no point of $X$ is a local extremum of $f.$
