The bankrupt hospital operator signed deals to sell three Massachusetts facilities to regional hospitals.