Ensure file handles are closed in setup.py

This change ensures the file handles are closed properly in setup.py.