President Barack Obama says the death of the Libyan leader ends a long, painful chapter for the country.