Restore Core Data error: The operation couldn’t be completed. (NSSQLiteErrorDomain error 5.)

I'm working on creating a backup file for core data and stored locally in the device, but i have error: "The operation couldn’t be completed. (NSSQLiteErrorDomain error 5.)" Im getting this error after trying to restore my data. I ben searching a lot and trying different things but noting changes.
Error Domain=NSSQLiteErrorDomain Code=5 "(null)" UserInfo={NSFilePath=/Users///////Library/Application Support/DataModel.sqlite, Source database Path=/Users///////Documents/Test.sqlite, reason=Failed to replace destination database}
Code Block
func restoreFromStore(backupName: String) {
let container = NSPersistentContainer(name: "DataModel")
let storeFolderUrl = FileManager.default.urls(for: .applicationSupportDirectory, in:.userDomainMask).first!
let storeUrl = storeFolderUrl.appendingPathComponent("DataModel.sqlite")
let backUpFolderUrl = FileManager.default.urls(for: .documentDirectory, in:.userDomainMask).first!
let backupUrl = backUpFolderUrl.appendingPathComponent(backupName + ".sqlite")
let description = container.persistentStoreDescriptions.first
description?.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey)
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
if let error = error as NSError? {
print("err:\(error)")
}
container.viewContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
container.viewContext.automaticallyMergesChangesFromParent = true
try? container.viewContext.setQueryGenerationFrom(.current)
container.viewContext.transactionAuthor = kCGPDFContextAuthor as String
do{
try container.persistentStoreCoordinator.replacePersistentStore(at: storeUrl, destinationOptions: nil, withPersistentStoreFrom: backupUrl, sourceOptions: nil, ofType: NSSQLiteStoreType)
} catch {
print("Failed to restore:\(error.localizedDescription)")
}
})
self.PassTable.reloadData()
}