Use with statement to open files

2 file handlers was not close. Use with statement permit to handle that for us.