Does there exist non-compact metric space $X$ such that , any continuous function from $X$ to any Hausdorff space is a closed map ?

I know that there is a topological space $X$ which is not compact but such that , for any Hausdorff topological space $Y$ , any continuous function $f:X \to Y$ carries closed sets to closed sets . I would like to ask , Does there exist any non-compact metric space $X$ such that , for any Hausdorff topological space $Y$ , any continuous function $f:X \to Y$ carries closed sets to closed sets ?

Solutions Collecting From Web of "Does there exist non-compact metric space $X$ such that , any continuous function from $X$ to any Hausdorff space is a closed map ?"

We have the following result in Set Topology:

Prop. Let $X$ be a space with the two properties that:
(i) each point has a neighborhood basis of closed neighborhoods ($X$ is regular), and
(ii) every continuous image of it in a Hausdorff space is closed.
Then $X$ is compact.

Proof. Suppose first $X$ is Hausdorff (the case of metric spaces). Let $\{U_i\}$ an open cover of $X$. By (i), every $x\in X$ has an open neighborhood $V^x$
with $\overline{V^x}\subset U_{i(x)}$. Define a Hausdorff space à la Alexandroff: $X^*=X\cup\{\omega\}$ adding to the topology of $X$ the open nbdhs for $\omega$: $$
U^\omega=X^*\setminus\bigcup_{\text{finite}}\overline{V^x}.
$$
Then $X^*$ is Hausdorff and by (ii) $X$ is closed in $X^*$. Thus $\omega$ is open, that is
$$
\{\omega\}=X^*\setminus\bigcup_{\text{finite}}\overline{V^x},
\quad
\text{so that}
\quad
X=\bigcup_{\text{finite}}\overline{V^x}\subset\bigcup_{\text{finite}}U_{i(x)}.
$$
This completes the argument in the compact case.

In the general case, this hint: identify points in $X$ that cannot be separated in this sense: $x\equiv y$ iff every neighborhood of $x$ contains $y$ and every nbhd of $y$ contains $x$. The quotient $\widetilde X$is Hausdorff and all open sets are saturated. Then we can construct $\widetilde X^*$ to conclude. $\ \square$

In our case, $X$ is metric, hence Hausdorff and regular, and (ii) is weaker than every continuous mapping into a Hausdorff space is closed. Hence the answer to your question is no, there is no such a metric space.