final step in free memory