Ensure file handle is closed by using with statement

This change ensures the file handle in `setup.py` is closed.