Close Duplicate Finder windows

I sometimes have several duplicate Finder windows open at the same time. I wrote this AppleScript which quickly closes any duplicate windows, leaving only one of each open.

script pruneDupFWins
	-- tested 07/09/12
	-- Enhanced to consider Spotlight windows 09/09/12
	-- Optimized for speed 10/09/12
	-- © McUsr 2012 Parts made by Nigel Garvey
	property parent : AppleScript
	property scriptTitle : "Close Duplicate Windows"
	property FinderIcon : a reference to file ((path to library folder from system domain as text) & "")
	on run
	local wCount, i, res, res2, fail, prevApp
	script o
	property wlist : {{}, {}}
	property slist : {}
	property klist : {}
	property dlist : {}
	end script
	set fail to false
	tell application id ""