Closes a file previously opened with create( ) or open( ).

Syntax

<oRef>.close( )

<oRef>

A reference to the File object that created or opened the file.

Property of

File

Description

close( ) closes a file you’ve opened with create( ) or open( ). close( ) returns true if it’s able to close the file. If the file is no longer available (for example, the file was on a floppy disk that has been removed) and there is data in the buffer that has not yet been written to disk, close( ) returns false.

Always close the file when you’re done with it.

To save the file to disk without closing it, use flush( ).