If you work with the Finder a lot, you probably already know that Option-clicking the close widget (the red dot in the window’s title bar) will close all open Finder windows. But what if you want to leave the frontmost window open, but close all the rest? Here are two answers to that question.
The easy way
In the window you wish to keep open, hit Shift-Command-G. This will drop down a “Go to Folder” dialog. Now hit Command-Option-W—this is the keyboard equivalent of Option-clicking the close widget. When you type this command, every window other than the frontmost one will close. Now just hit Escape to dismiss the dialog, and you’re set.
The fancy way
Using a simple AppleScript, you can create a tool for your toolbar or sidebar (or you could assign it to a hotkey using a third-party keyboard shortcut tool). Open Script Editor, in /Applications -> AppleScript, and paste in this simple script:
tell application "Finder"
repeat while window 2 exists
close window 2
Save this as an Application, and check the Run Only box. Now drag the application you just created onto your toolbar or sidebar, and just click it whenever you want to close all but the current window.