patch 8.1.0243: using :term ++close ++hidden closes a window

Problem:    Using :term ++close ++hidden closes a window. (Marcin Szamotulski)
Solution:   Don't close the window if only using it temporarily for unloading
            the terminal buffer. (closes #3287)
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index 9126324..b82dae1 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -1621,3 +1621,15 @@
   call WaitForAssert({-> assert_equal('finished', term_getstatus(bnr))})
   bwipe!
 endfunc
+
+func Test_terminal_hidden_and_close()
+  if !has('unix')
+    return
+  endif
+  call assert_equal(1, winnr('$'))
+  term ++hidden ++close ls
+  let bnr = bufnr('$')
+  call assert_equal('terminal', getbufvar(bnr, '&buftype'))
+  call WaitForAssert({-> assert_false(bufexists(bnr))})
+  call assert_equal(1, winnr('$'))
+endfunc