A dire shortage of treatment beds has kept people suffering a mental health crisis languishing in emergency rooms for days and weeks without access to treatment. Mental health advocates say it’s had another serious consequence: The premature release of people held against their will for safety reasons.