Consider $X=(\mathbb{R}, \textrm{indiscrete topology})$ and $Y=(\mathbb{R}, \textrm{euclidean topology})$. Let $\iota: X \to Y$ be the map given by $\iota(x) = x$. Observe that $\iota^{-1}(\\{z\\}) = \\{z\\}$ and $\\{z\\}$ is closed in $Y$, but not in $X$ since the only closed sets are $\emptyset, \mathbb{R}$ with the indiscrete topology.