Please use a with statement here instead of manually opening and closing the file.