refreshing Home Sharing photo library for AppleTV with applescript

I’m trying to write an applescript that refreshes the shared photo-library for Home Sharing.
In my case I’m using the german version of iTunes.

What the script does:
The script clicks on menu item File/Home Sharing/Choose photos to share with Apple TV (german: "Privatfreigabe/Fotos zum Teilen mit Apple TV auswählen) then it unchecks the checkbox in the new window, waits 1 sec, checks the checkbox again, waits 1 sec and clicks on the button on the bottom right that closes the window. Now the photo library is refreshed for my Apple TV.
The script works, but I get an error when clicking on the Button “Fertig” of the window (must be captured “OK” oder “done” in english).
It says something like: system events is not able to read window. error (-1728)
But the script does, what it is supposed to.

Any idea what causes the error and how to solve this?


tell application "System Events"
	tell process "iTunes"
		click menu item "Fotos zum Teilen mit Apple TV auswählen ." of menu 1 of menu item "Privatfreigabe" of menu "Ablage" of menu bar 1
		tell application "iTunes" to activate
		do shell script "sleep 1"
		click checkbox "Fotos teilen aus:" of scroll area 1 of window "Fotofreigabe-Einstellungen"
		do shell script "sleep 1"
		click checkbox "Fotos teilen aus:" of scroll area 1 of window "Fotofreigabe-Einstellungen"
		do shell script "sleep 1"
		click button "Fertig" of window "Fotofreigabe-Einstellungen"
		do shell script "sleep 1"
	end tell
end tell

Model: iMac 10.11.6
AppleScript: 2.8.1
Browser: Safari 603.1.30
Operating System: Mac OS X (10.10)