Fix to release resources when terrain test exits.