Previously $window was only set by the new_window() helper when it was
passed a name argument. This caused weird behavior cause if it was
called without a name it would simply attempt to recreate the same
window and fail. That was until @blueyed's fix in 2249cf8.
However, the $window var still wasn't being set correctly, leaving
split_v(), split_h() and other helpers to operate on the wrong
window. This is no longer an issue as $window is always set to the index
of the currently active window at the end of new_window() and
select_window().