- fputc ('\n', CONSOLE_STREAM_DATA (con)->outfd);
- fflush (CONSOLE_STREAM_DATA (con)->outfd);
+ if (/* stream_con->needs_newline */
+ stdout_needs_newline) /* #### clean this up */
+ {
+ fputc ('\n', stream_con->out);
+ fflush (stream_con->out);
+ }
+ if (stream_con->in != stdin)
+ fclose (stream_con->in);
+
+ xfree (stream_con);
+ CONSOLE_STREAM_DATA (con) = NULL;