For now run flush in beforeIndexShardClosed() until PR #7563 gets in.