Module 7

Why files should be closed

Avoiding resource leaks.

Cleaning up

When you open a file, your computer allocates resources to track it. If you forget to close it, those resources stay in use. Closing a file frees them.

Why should you close a file?