added function to continue saving next batch