功亏一篑
give up when near success.
look back from the plough.
another course would have done it.
eg:regrettable to see that you give up when near success.
中英俚语俗语来源:尚书·旅英:"为山九仞,功亏一篑。"
反义词:大功告成 come off with honours