patch 8.2.2594: alternate buffer added to session file even when it's hidden

Problem:    Alternate buffer added to session file even when it's hidden.
Solution:   Check the 'buflisted' option. (closes #7951)
diff --git a/src/session.c b/src/session.c
index a734656..6e73bb6 100644
--- a/src/session.c
+++ b/src/session.c
@@ -401,11 +401,12 @@
     {
 	buf_T *alt = buflist_findnr(wp->w_alt_fnum);
 
-	// Set the alternate file.
+	// Set the alternate file if the buffer is listed.
 	if ((flagp == &ssop_flags)
 		&& alt != NULL
 		&& alt->b_fname != NULL
 		&& *alt->b_fname != NUL
+		&& alt->b_p_bl
 		&& (fputs("balt ", fd) < 0
 		|| ses_fname(fd, alt, flagp, TRUE) == FAIL))
 	    return FAIL;