I gave an answer to the following question Finding an (easy) example of a bijective continuous self mapping whose inverse is not continuous. In this question the OP asked for a continuous mapping $f: (X,d) \rightarrow (X,d)$ which is bijective, continuous and not a homeomorphism (and $(X,d)$ a metric space). The famous Kavi Rama Murthy then remarked that all the counterexamples are for metric spaces which are incomplete. I gave it some thoughts and come up with a counterexample where the space is complete. However, I did not manage to make it work within $\mathbb{R}$. So my question is:
Does there exist some closed subset $X\subseteq \mathbb{R}$ and a function $f: X \rightarrow X$ which is bijective, continuous (wrt to the subspace topology) and not a homeomorphism.
My intuition tells me that it is not possible as there are at most two noncompact connected components. Thus, preventing us to play the game of gluing together connected components to prevent the inverse function to be continuous. Let me elaborate a bit on this thought.
We note that we may wlog assume that $X$ has no unbounded connected components. Simply as those would be the only noncompact connected components and as continuous functions send compact sets to compact sets and our $f$ is bijective, we would have that it sends unbounded connected components to unbounded connected components. Either the image of the unbounded connected component covers an unbounded connected component, or we need to cover a bounded half-open interval by countably many compact disjoint intervals (which is not possible using a Baire-category argument, see for example here https://terrytao.wordpress.com/2010/10/04/covering-a-non-closed-interval-by-disjoint-closed-intervals/). Thus, unbounded connected components get swapped or fix and hence, the $X$ with the unbounded connected components replaced by points are a counterexample as well.
Hence, $X$ can be taken to be a countable union of compact intervals. On the other hand, it is not possible that $X$ is compact (continuous functions from a compact space into a Hausdorff space are closed, which would make our function a homeomorphism).
Furthermore, using again that we cannot cover a half-open interval with countably many disjoint compact intervals, we get that all that $f$ can do is permuting connected components (it maps some intervals to another interval and points to points).