Related to https://github.com/elastic/ingest-dev/issues/2878
During agent upgrade, there could be failures that cause the upgrade to be retried. When the retries happen, the agent binary should not be downloaded multiple times.
Keep the downloaded agent binary until the upgrade is completed successfully, and delete when the upgrade is completed.