63a0660cc3
Previously, we didn't close caches if incremental compilation failed.
The assumption was that we would fall back to non-incremental
compilation, where it shouldn't matter whether caches were closed or not
as non-incremental compilation should be able to recover from a
corrupted state of the caches.
However, this choice might have caused issues such as KT-55709 where
non-incremental compilation fails after fallback.
In this commit, we will now always close the caches before falling back,
just to be safe.
TODO:
1. We'll need to verify whether not closing the caches was the actual
cause of KT-55709, and that this commit fixes it.
2. Even if this commit fixes the issue, we'll need to see why
non-incremental compilation fails to recover from unclosed caches
(it would remain unsafe if that was not addressed).
^KT-55709 In progress (see TODO #1 above)