Update all.py

Changed file handler to use with open() to ensure each file is closed cleanly.