Adding 'with' statement to clean up opening and closing the files