quit while one is ahead

verb
Graduate
1

To stop taking risks before one starts losing.