cli: save state after adjusting retain flag