That depends. My mom left on her own recognizance against medical advice. They refused to give her an official discharge. She called my brother and left anyway. They told her that she would never be allowed back-she said good.
I’ve had some issues with being discharged on my desired timing.
Usually some serious persistence has been required.
I suspect that it is becoming a more serious problem in the COVID days.