Updated to remove deploy file only as last action if required