Stub indexes are deleted on window deactivation

We have a stub index, but when I use the Index Viewer plugin I see that the stub indexes of the currently open files for this particular element type are deleted on window deactivation (when switching away from intellij).
The stub indexes of the whole file will be added back once a new element of that type is created by typing in the editor, but will be deleted again (and not be returned by StubIndex.getAllKeys) when the window is deactivated.

I thought that stub indexes would not be deleted unless you invalidate caches or update the stub version. What could cause these stub indexes to be deleted?

Source: TeXiFy-IDEA/src/nl/hannahsten/texifyidea/index/stub/LatexCommandsStubElementType.kt at master · Hannah-Sten/TeXiFy-IDEA · GitHub