Definition of continuity: A function $f: X \to Y$ (where $X$ and $Y$ are topological spaces) is continuous if and only if for any open subset $V$ of $Y$, the preimage $f^{-1}(V)$ is open in $X$.
Now, if $U$ is a closed subset of $X$ (meaning that the complement of $U$, $U^c$ is open and it contains all of its cluster points) and $f(U)$ (the image of $U$ under $f$) $= V$ is open in $Y$, then if $f$ is continuous, $f^{-1}(V) = f^{-1}(f(U)) = U$ is open. So if $U$ is closed then this leads to a contradiction. Conversely, if $U$ is open in $X$ and $f(U)=V$ is closed in $Y$, then $V^c$ is open. However, the complement of the preimage $f^{-1}(V)$ is closed since $(f^{-1}(V))^c = U$ which is open; which again leads to a contradiction. If there is anyone who has some valid counterexamples I'd be eager to see them.