A 9-year-old boy who begged to be released from an immigration detention center so he could attend his state spelling bee has been freed with his family.