Closing a window 12/12/2012
# browser.window refers to a new window that was opened in the test
browser.window.close

# In case multiple new windows are opened, the following can be used
browser.windows.each do |w|
  w.close if w.title =~ /window to be closed/
end

# Alternatively, the map method can be used in the folowing way
browser.windows.map { |w| w.close if w.title =~ /window to be closed/ }

Closing a window, for example, after testing if a link opens a new window can be done as shown in this droplet.