Ensure any output written is fully cleaned up to prevent downstream retry tasks from failing