patch 8.0.0797: finished job in terminal window is not handled

Problem:    Finished job in terminal window is not handled.
Solution:   Add the scrollback buffer.  Use it to fill the buffer when the job
            has ended.
diff --git a/src/buffer.c b/src/buffer.c
index 4510078..e4b3b04 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -858,7 +858,7 @@
     channel_buffer_free(buf);
 #endif
 #ifdef FEAT_TERMINAL
-    free_terminal(buf->b_term);
+    free_terminal(buf);
 #endif
 
     buf_hashtab_remove(buf);