patch 8.2.0984: not using previous window when closing a shell popup window

Problem:    Not using previous window when closing a shell popup window.
Solution:   Use "prevwin" if it was set. (closes #6267)
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index 1e7d5ee..2188c2c 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -2461,6 +2461,23 @@
   call assert_equal(origwin, win_getid())
 endfunc
 
+func Test_popupwin_close_prevwin()
+  CheckFeature terminal
+
+  call assert_equal(1, winnr('$'))
+  split
+  wincmd b
+  call assert_equal(2, winnr())
+  let buf = term_start(&shell, #{hidden: 1})
+  call popup_create(buf, {})
+  call term_wait(buf, 100)
+  call popup_clear(1)
+  call assert_equal(2, winnr())
+
+  quit
+  exe 'bwipe! ' .. buf
+endfunc
+
 func Test_popupwin_with_buffer_and_filter()
   new Xwithfilter
   call setline(1, range(100))