Reorder the closing of resources.