This is apparently needed to properly destroy all memory allocations.