patch 7.4.1814
Problem:    A channel may be garbage collected while it's still being used by
            a job. (James McCoy)
Solution:   Mark the channel as used if the job is still used.  Do the same
            for channels that are still used.
diff --git a/src/eval.c b/src/eval.c
index 2b4f230..fa2f839 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -7024,6 +7024,7 @@
 
 #ifdef FEAT_JOB_CHANNEL
     abort = abort || set_ref_in_channel(copyID);
+    abort = abort || set_ref_in_job(copyID);
 #endif
 #ifdef FEAT_NETBEANS_INTG
     abort = abort || set_ref_in_nb_channel(copyID);