Pywgrib_s opens a file when you use it, and automatically closes
the file when the program ends. You may want to manually close file
- the system limits the number of open files, and you
need to close some files before reaching the system limit.
- You need to flush the file buffes so a program other than pywgrib2_s
can read the file.
- pywgrib2_s had an error and the file state needs to be cleaned.
- free up memory used to buffer the reads or writes to a no longer used file
if file is a memory file, the memory file is set to zero length
if file is open, it closes the file, frees the resources, and returns 0
closing the file will flush any write buffers
if file not open, it returns 1