Add missing frees to stream_close() and do_exit().