Works for me:
__________________________________________
irb(main):001:0> require 'watir-webdriver'
=> true
irb(main):002:0> b = Watir::Browser.new
=> #<Watir::Browser:0x..fb514d2a0 url="about:blank" title="">
irb(main):003:0> b.goto 'google.com'
=> "http://www.google.co.uk/"
#Here I manually opened a new window from that session.
irb(main):004:0> b.windows.count
=> 2
irb(main):005:0> b.windows.each do |w|
irb(main):006:1* puts w.title
irb(main):007:1> end
Google
Gmail: Email from Google
=> [#<Watir::Window:0x..fb49b4dbe located=true>, 
#<Watir::Window:0x..fd178cb4a located=true>]
irb(main):008:0> b.windows.each do |w|
irb(main):009:1* w.close
irb(main):010:1> end
=> [#<Watir::Window:0x..fb49b4dbe located=true>, 
#<Watir::Window:0x..fd178cb4a l
ocated=true>]
#All Windows closed!
__________________________________________

Perhaps there's some Javascript code preventing the window from closing 
until you've made a selection. In which case you'll need to interact 
with the window before closing it. The same principle applies, you just 
transfer control to the popup until you're done with it.

When you use this:

$browser.windows.last.use do

The variable "$browser" will refer to the last window (or whichever one 
you choose in that line) until it reaches "end". It should just be a 
matter of interacting with the selected window in the same way as you 
normally would.

-- 
Posted via http://www.ruby-forum.com/.