how do you fix this error:
while not(len(word) == 5):
write = open("words.txt", "w").write("brake\nbreak\napple\ngrape\nchair\ngrain\nhorse\nshark\ntrain\ntrail\ncrown\nqueen\nsouth\nnorth\nocean\nprint\nsword\ntable\nalien\njesus\ncouch\nbrand\nstore\ngreat\nsuper\nframe\nimage\nseven\nboard\nstink\nenter\nlevel\nshell\nspoon\nforks\npaper\nknife\nmouse\nriver\nhouse\nstart\npixel\nforce\nwatch\nlater")
lines = len(open("words.txt").readlines())
line = random.randint(0,lines)
mincol = line * 6
maxcol = mincol + 5
read = open("words.txt").read()
word = open("words.txt").read()[mincol:maxcol]
file = open("words.txt").close()
code snippet