Problem: Crash when deleting terminal buffer and TermClose deletes other buffers. Solution: Close the terminal after restoring b_nwindows. (cherry picked from commit 7297e9d339)
7297e9d339
vim.wait()