Stats: add segments.index_writer_max_memory to see index writer's max RAM usage before buffered documents must be written to a new segment

Closes #7438

Closes #7440