When you have finished reading from or writing to a file, use close to indicate that you no longer need the file:
myfile = open("myfile.txt", "r") list = myfile.readlines() myfile.close()
After the file is closed, your program can no longer read from the file or write to it.