Process.out.flush() resulting into Stream closed

I am using Java 1.8, with node version 10.22.1, running on a Docker container mounted on Linux OS

In my program i am creating a process using the ProcessBuilder class, which is getting successfully created. On execution of oProcess.start(), relevant information from Process Control Block can be accessed. The problem is on completion of the tasks related to the process, when i flush the process, it is giving me error as

Caused by: Stream closed

at java.lang.ProcessBuilder$NullOutputStream.write( ~[?:1.8.0_292]

at ~[?:1.8.0_292]

at ~[?:1.8.0_292]

at ~[?:1.8.0_292]


String command = "/node/app/bin/sampleapp.js"
final ProcessBuilder oProcessBuilder = new ProcessBuilder(command);
Process oProcess = oProcessBuilder.start();
OutputStream out = oProcess.getOutputStream();

Pls check and let me know what am i doing wrong here