Use async to write the index