The easiest way to close a file is simply to eliminate all references to it, subsequently the garbage collector will close it for you. It is better to close files explicitly though since only a limited number of files may be opened concurrently.
Until a new file is opened on file-object any read/write accesses to it are illegal and an error will be signalled.
Go to the first, previous, next, last section, table of contents.