The RPC server is unavailable
If you are restarting browsers in your test scripts, you might have seen this error:
unknown property or method `document' HRESULT error code:0x800706ba The RPC server is unavailable
The problem is that the close method returns before the browser RPC server has shut down.
Instead of using IE.new for opening a new window, you should use IE.new_process method. This starts up a new IE process for each IE window. For example,
require 'watir/contrib/ie-new-process'
$ie = Watir::IE.new_process