So, I am trying to find a function with requirements of being closed but not open and not continuous which is defined on the real numbers and the usual topology.
I was able to find many piecewise functions that meets the requirements but it feels very cheesy and not mathematical. Does the function x -> $\sqrt x$ meet the requirements.
Why I think it does: It is not continuous since it is not defined in the negative numbers. It is not open because (-b,b)-> [0, $\sqrt b$) It is closed because function of any form including the real numbers is mapped either to [0, $\sqrt b$] or [$\sqrt a$ ,$\sqrt b$]
am I correct? If not can someone give an example of a function that isn't piecewise?
No, you are not correct. That is a continuous function from $[0,\infty)$ into $\Bbb R$. The fact that's undefined on the negative numbers does not make it discontinuous.
You can take, say,$$f(x)=\lim_{n\to\infty}\left(\frac1{1+x^2}\right)^n=\begin{cases}1&\text{ if }n=0\\0&\text{ otherwise.}\end{cases}$$