flush index at the end of batch upload