1) Yes, because every open set in $\mathbb R$ is a countable union of compact sets, whose image is compact (hence closed). 2) No, because the usual Cantor set $C$ (uncountable, totally disconnected) is closed, and any continuous function $f:O\to C$ must be constant on each of the (countably many) connected components of the open set $O$. --- Replacing the open sets at the source by closed sets, then 1) still holds, because every closed set is a countable union of compact subsets. 2) becomes true, because every countable union of closed sets is a countable union of closed bounded sets, say $(K_1,K_2,\ldots)$. Then each $K_i$ is the image of some affine function defined on a closed subset of $(i-1/2,i+1/2)$ (just fit a rescaled version of $K_i$ into this interval), so patching all these functions and closed sets together leads the result.