If you see error -54 when you sync with iTunes https://support.apple.com/en-us/HT205597 This can happen if a file on your computer or iOS device is locked.
From an OS9 reference, error -54 is a software lock on a file or a permissions error. (Although there is no formal list of OSX error code some of the old codes still apply to OSX .)
First, try simply restarting your computer.
Try quitting iTunes, then deleting the .xml (not .itl !) version of the library file in the iTunes folder (iTunes will generate a new one).
iTunes Library cannot be saved (Error -54) - https://discussions.apple.com/thread/1912814 - various things to try.
Unknown error (-54) while syncing ipod - https://discussions.apple.com/thread/1082953 - problem was locked files
Mar. 2016 LincDavis post: https://discussions.apple.com/thread/7501649?answerId=29951885022#29951885022
Why does iTunes keep showing a -54 error when I sync my iPad? - https://discussions.apple.com/thread/3727114
Apr. 2016 Unknown Sync error occurred (-54) - https://discussions.apple.com/thread/7245433 - Problem was iBooks