Record locked error can be avoided by two ways
Change schema of Object : Check every Lookup field and make sure that in Lookup Option you have notselected “Don’t allow deletion of the lookup record that’s part of lookup relationship”. Because of this selection, even during insert operation system hold lock against record and other batches accessing same record fails.
Order Insert operations in CSV File : In this option, Sort column containing parent record Id for Lookup fields. So all records of same parent will be loaded in same batch and parent record locked problem across batch will be resolved