close
Closes the store, then the index catalog. Idempotent.
The order is store first, and it is not arbitrary. DocumentStore.close stops maintenance before anything else, and stopping it joins the worker rather than cancelling it — so a flush that was in flight completes and reports its documents to the observer. Closing the index catalog first would make that flush's beginSegment return null, and the segment it wrote would silently have no sidecar: correct, since a missing sidecar reads as uncovered, but a scan's worth of work thrown away for nothing.
Nothing is deleted by either close — an index catalog releases its mappings rather than retiring them, because shutting down is not departing — so the rule that a mapped file cannot be deleted on Windows does not decide the order here. What it does decide is that both must release before the directory can be removed, which is why this method exists at all and why the test for it deletes the directory rather than measuring anything.
Both steps run even if the first throws; a second failure is attached to the first as a suppressed exception rather than replacing it.