Process.out.flush() resulting into java.io.IOException: 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: java.io.IOException: Stream closed

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

at java.io.OutputStream.write(OutputStream.java:4) ~[?:1.8.0_292]

at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:4) ~[?:1.8.0_292]

at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:1) ~[?:1.8.0_292]


Code:

String command = "/node/app/bin/sampleapp.js"
final ProcessBuilder oProcessBuilder = new ProcessBuilder(command);
Process oProcess = oProcessBuilder.start();
OutputStream out = oProcess.getOutputStream();
out.write("\n[:--:]".getBytes());
out.flush();

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