PRD-4856 - Perform proper cleanup even when transformation fails.