Modify sawguq_generate.py

File operations using with statements for security.