**Describe the issue**

I use a vim plugin that when use Vim to open a ipynb (python notebook) file, will call `system` function to use `jupytext` create corresponding python file to enable use like, YCM to help coding. This plugin set a autocmd BufUnload for the python file buffer to delete the python file when I quit Vim .

The bug is if the current buffer in current window is not the python file when quit Vim, the python file still there after quit Vim.

**To Reproduce**

I turn the plugin to a minimal version just vimscript.

1. Copy file `test_unload.vim` to ~/.vim/plugin (content of test\_unload.vim will post below) .
2. `touch tt.ipynb && vim tt.ipynb`
3. `:e tt.c`
4. `:q`

After above steps, their should no `tt.py` file on disk, but have on `tt.py`.

**Contents of test\_unload.vim**

```
if exists("loaded_test")
  finish
endif

function! s:read_from_ipynb()  "{{{
  if expand("<afile>:e") != "ipynb"
    echo "Not an ipynb file."
    return
  endif
  let l:filename = expand("%:p")
  let l:py_file = fnamemodify(l:filename, ":r") . ".py"
  " create python file
  call system('sleep 1;echo 123 > ' . l:py_file)
  " open the py file, wipe the ipynb file
  let l:bufnr = bufnr("%")
  execute "edit " . l:py_file
  execute "bwipeout" . l:bufnr
  set filetype=python
  execute "autocmd ipynb BufUnload <buffer> call s:cleanup()"
  let b:ipynb_file = l:filename
endfunction  "}}}

function! s:cleanup()  "{{{
  if !exists("b:ipynb_file")
    echo "Not a ipynb py file."
    return
  endif
  call delete(expand("<afile>:p"))
endfunction  "}}}

augroup ipynb
  au!
  autocmd BufReadPost *.ipynb call s:read_from_ipynb()
augroup END

let loaded_test = 1

```

What's in vimrc:

```
hmanx ~ » cat .vimrc            
set hidden
hmanx ~ »

```

**Expected behavior**

`tt.py` deleted by autocmd BufUnload when quit Vim.

**Environment:**

* Vim version: 8.2.1989-2
* OS: Manjaro Linux
* Terminal: Konsole

**Additional context**

I found the autocmd BufUnload did triggered when quit Vim, but it returned before delete `tt.py` as the condition `!exists("b:ipynb_file")` is true.

---

Thanks in advance!