Ensure file handles are closed using with statement

This commit ensures the file handles in `setup.py` are closed automatically.