When Stream is a physical stream, it is closed, but all logical streams associated to it are still open until they are closed or redirected to other physical streams. As long as there are some logical streams associated to a physical stream, the physical stream cannot be reused for other communication channels.
When Stream is a logical stream, it is closed and its name no longer refers to any logical stream. If its corresponding physical stream is open, it is closed as well.
When an attempt is made to close a system stream, an error is raised. To close a physical stream connected with a system stream it is therefore advisable to redirect the system stream to another physical stream. Note also that the default error handler for the error 196 first resets all system streams connected to the physical stream to their defaults and then closes the physical stream. If the user tries to close the default stream, the error handler just succeeds.
Success: open(file1,write,s),write(s, a(b,c)),close(s). [eclipse]: open(junk, write, a), set_stream(b, a), get_stream(a, S). S = 5 yes. [eclipse]: close(a), open(junk1, write, X). X = 6 % 5 is not reused because b still points to it yes. [eclipse]: close(b), open(junk2, write, Y). Y = 5 % now 5 can be reused yes. Error: close(Stream). (Error 4). close("4"). (Error 5). close(10). (Error 172). close(nostream). (Error 193). close(null). (Error 196).