Making sure to copy arrays from cdf object before closing it