No, you won't lose credits unnecessarily if a migration fails midway. The credit equals to each file size (that's about to get migrated) will be consumed only if the migration for that file was successful:


In other words If a migration fails midway, only the files that were successfully migrated will contribute to the consumed credit. 


PS: View Mass File Migrate Salesforce file migration app on Salesforce AppExchange:

https://appexchange.salesforce.com/appxListingDetail?listingId=e9874a66-2001-4e3d-8a29-3a2ed7f584c4