Amazon has agreed to block sales of skin-lightening creams containing dangerous amounts of mercury.