fix file deletion on retries