Let be a function with Darboux's property. , we have is closed. Prove that is continuous.

So I have an idea of how to approach this, but I'm not entirely sure on the closed part - does that necessary entail that the function is surjective? (If not, the pre-image wouldn't exist?)