Australia has agreed to stop using a controversial security contractor to run asylum-seeker centres in Papua New Guinea which have been plagued by incidents of self-harm and attempted suicide.