OutputStream无法正常关闭

问题遇到的现象和发生背景

OStream无法关闭,用的是Eclipse 2020

问题相关代码,请勿粘贴截图

package IOStream_package;

import java.io.*;

public class ReadAndWrite {

public static void main(String[] args) {
    InputStream istream;
    OutputStream ostream;
    File outputFile = new File("E:\\java\\file\\ReadWrite");
    int c;
    final int EOF = -1;
    istream = System.in;
    ostream = System.out;
    
    try {
        ostream = new FileOutputStream(outputFile);
        System.out.println("Type some characters ");
        try {
            while((c = istream.read())!=EOF)
                ostream.write(c);
        }catch(IOException e){
            System.out.println("Error:"+e.getMessage());
        }
        finally {
            try {
                istream.close();
                ostream.close();
                System.out.println("File closed.");
            }catch(IOException e) {
                System.out.println("File did not close.");
            }
        }
    }catch(FileNotFoundException e) {
        System.exit(1);
    }
}

}

运行结果及报错内容

img

我的解答思路和尝试过的方法

交换过istream.close()和ostream.close()的位置,结果istream.close也无法执行。

我想要达到的结果

ostream和istream都同时关闭

ostream是System.out,这两个不用关闭吧