read-cache.c: move tempfile creation/cleanup out of write_shared_index