Where is photos.sqlite-shm
If the Photos app is open on your Mac it opens photos.sqlite-shm. You can see what files Photos has open using Activity monitor. For me it is ~/Pictures/Photos Library.photoslibrary/database/Photos.sqlite-shm
Thus your sync process is correctly saying that  the file is in use
Your process thus has to make sure that Photos.app is not running.