If $A \subseteq [0,1] \cup [2,3]$ is closed, let $y \in \overline{f(A)}$. As $[0,2]$ is metric there is a sequence $( y_n )_n$ in $f(A)$ converging to $y$. For each $n$ there is an $x_n \in A$ such that $f(x_n) = y_n$. Now there is a subsequence $(x_{n_i})_i$ of $( x_n )_n$ which is either entirely contained in $[0,1]$ or entirely contained in $[2,3]$, and we can show that $| x_{n_i} - x_{n_j} | = | y_{n_i} - y_{n_j} |$ for all $i,j$. The subsequence $( x_{n_i} )_i$ must be then Cauchy, and so it converges to some $x$. By closedness of $A$, $x \in A$. If $f(x) \neq y$ then letting $\delta = \frac{|f(x)-y|}{2}$ there is an $M$ such that $| f(x) - y_{n_i} | > \delta$ for all $i \geq M$, but then $| x - x_{n_i} | > \delta$ for all $i \geq M$, contradicting that $( x_{n_i} )_i$ converges to $x$. So $f(x) = y$, and so $y \in f(A)$. Thus $f(A)$ is closed.
Alternatively you could use the following characterization of closed mappings (see this previous question):
Fact. A mapping $f:X \to Y$ between topological spaces is closed iff for each $y \in Y$ and each open $U \subseteq X$ with $f^{-1} (y) \subseteq U$ there is an open neighborhood $V$ of $y$ such that $f^{-1} ( V ) \subseteq U$.
Now, given $y \in [0,2]$ and an open $U \subseteq [0,1] \cup [2,3]$ with $f^{-1} ( y ) \subseteq U$, for each $x \in f^{-1} (y)$ there is a $\delta_x > 0$ such that $( x - \delta_x , x + \delta_x ) \cap X \subseteq U$. As $f^{-1} (y)$ is finite let $\delta = \min \{ \delta_x : x \in f^{-1} (y) \}$, and take $V = (y- \delta, y+\delta) \cap Y$.