Fixed "end element" to terminate record in outer-most level.