South African police say they have ended a rescue operation at an abandoned gold mine where scores of illegal miners were trapped and believe they rescued all the survivors and retrieved all the bodies of those who died.