patch 9.0.1439: start Insert mode when accessing a hidden prompt buffer

Problem:    Start Insert mode when accessing a hidden prompt buffer.
Solution:   Call leaving_window() in aucmd_restbuf(). (Thorben Tröbst,
            closes #12148, closes #12147)
diff --git a/src/autocmd.c b/src/autocmd.c
index fe2b6cb..e5f5125 100644
--- a/src/autocmd.c
+++ b/src/autocmd.c
@@ -1657,7 +1657,10 @@
 	    }
 	}
 win_found:
-
+#ifdef FEAT_JOB_CHANNEL
+	// May need to stop Insert mode if we were in a prompt buffer.
+	leaving_window(curwin);
+#endif
 	// Remove the window and frame from the tree of frames.
 	(void)winframe_remove(curwin, &dummy, NULL);
 	win_remove(curwin, NULL);