Handle possible race condition in index updates

When initial creation has failed, the index update could have been
deleted meanwhile.

Signed-off-by: Michal Čihař <michal@cihar.com>