patch 8.1.0358: crash when using term_dumpwrite() after the job finished

Problem:    Crash when using term_dumpwrite() after the job finished.
Solution:   Check for a finished job and give an error message.
diff --git a/src/terminal.c b/src/terminal.c
index 8524560..0c7630c 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -3871,6 +3871,11 @@
     if (buf == NULL)
 	return;
     term = buf->b_term;
+    if (term->tl_vterm == NULL)
+    {
+	EMSG(_("E958: Job already finished"));
+	return;
+    }
 
     if (argvars[2].v_type != VAR_UNKNOWN)
     {