fileObject.close()
pyuser@deyu:~/zzz$ cat fileio2.py
#!/usr/bin/python
# Open a file
fo = open("fileio.txt", "ab+")
print("Name of the file:", fo.name)
print("1. Closed or not:", fo.closed)
# Close opend file
fo.close()
print("2. Closed or not:", fo.closed)
pyuser@deyu:~/zzz$ ./fileio2.py Name of the file: fileio.txt 1. Closed or not: False 2. Closed or not: True