Flush caches before updating index

This is mostly needed for testsuite, but might be triggered in some
complex setups as well.