Defending champion Iga Swiatek avoids her earliest French Open exit by saving a match point before beating Naomi Osaka in a second-round thriller.