ac66fb193f
Would crash when the active index was out of range, since there is no reason to use the active layer when freeing all, free the first instead.