Fixed concurrent modification in memory release.