South Korea president close to averting impeachment