Stan Wawrinka was in command against Novak Djokovic when the defending champion retired at the US Open.