Output to a stream is not necessarily sent immediately; it is
buffered. The predicate
flush_output/1 flushes the output
buffer for the specified stream and thus ensures that everything that
has been written to the stream is actually sent at that point.
flush_output(Stream)sends all data in the output buffer to stream Stream.