Closing New Window in Keynote

I have scripted adding an effect in keynote with this

activate application "Keynote"
tell application "System Events"
	tell process "Keynote"
		click UI element "Add an Effect" of front window
		click UI element "Blur" of scroll area 1 of UI element 1 of UI element "Add an Effect" of front window
		click UI element "Build Order" of front window
		click pop up button 1 of window "Build Order"
		click menu item "After Transition" of menu 1 of pop up button 1 of window "Build Order"
	end tell
end tell

How to script closing the window “Build Order”?

There are a couple of ways to do so.

Easiest would be to use the close command:

tell application "Keynote"
	set xy to "Build Order"
	close window xy saving yes
end tell

However, if you wish to remain in the ui scripting swamp, this should work. In general, each window has a handful of basic ui elements, including the three stoplight buttons. I never remember the order so I included a means to identify each button.

tell application "Keynote" to activate
tell application "System Events" to tell process "Keynote"
	
	-- determine which button is which
	UI elements of window 1
	set b1 to subrole of button 1 of window 1 -- AXCloseButton
	set b2 to subrole of button 2 of window 1 -- AXFullScreenButton
	set b3 to subrole of button 3 of window 1 -- AXMinimizeButton
	
	-- these are two different ways of saying basically the same thing
	-- perform action "AXPress" of button 1 of window 1
	tell button 1 of window "Build Order" to perform action "AXPress"
	
end tell

Thanks. I discovered the buttons after a lot of searching. Using the Close command creates an error. I was able to close the window with a script. However, the actions of the script did not stand up. The added effect did not persist . However, when I used the Keynote application directly, the effect worked normally. I had hoped to automate the entire process, but that now seems out of reach. My main script loops through a series of Filemaker Pro records, pastes images to Keynote, and runs an embedded Applescript that positions them, and calls the Magic Move transition to animate them. I had hoped to implement effects on select images via scripting, but I can ocomplish the objective directly with the Keynote UI. The whole idea is to simulate card play. The Blur effect need only be applied to images residing on 13 slides, so the task is not hopelessly tedious.