AVALANCHE: Move freeing of the used surfaces in Nim to a better place.