The Justice Department resolved a lawsuit that accused the social media company of illegally gathering children’s information.