[session] fix a bug in save-session when the log file was closed