Language:
Free Online Dictionary|3Dict

事敗垂成

Source : CEDICT

to fail on the verge of success (idiom)