retry loop cleanup