Ensure file handles are closed in setup.py

This change ensures the file handles are closed properly in setup.py.
Context managers are introduced in Python 2.5, and they don't require `__future__` import since Python 2.6.