check for null mailstream pointer in mailstream_close

if you have allocated a mailimap* and pass it to mailimap_logout without having connected first, it may not have a imap_stream and it will crash in mailstream_close.