agent: Adjust cleanup for supervised mode. Fix for W32.