Ensure file handle is closed using with statement

This ensures the file handles are properly closed within `setup.py`.