Fixed tests to properly close windows after running.
Added some additional assertions against the window arg as per review comments from Alex.