Please use the with statement. Otherwise the used file might not be closed correctly.