More recent Vim patches have setbufline() and deletebufline() functions for modifying buffers other than the current one. These functions can be used to fix buffers which are not in view straight away, instead of waiting for the user to switch to them again. These functions do not exist in NeoVim, but it does offer nvim_buf_set_lines in some versions. I am not sure if that function supports deleting lines or not.