i want to write to text file without closing because i don't know what i'll stop close,i'll explain the hole issue
i've create text called resume.txt , so after each specific processes in my project  it will overwrite in resume.txt so every time my project start it will check that file to know the last processes so my issue after each writing i have to close to apply it and i don't really think this is good i think there is better solution 
this code will not work
wr = open('resume.txt','w')
login(usr,pas)
wr.write('login')
post(msg,con)
wr.write('post')
..so on 
the issue is how to write without closing , i can't write the wr.close at the end because it might be terminated by the user or connection time out .. etc 
 
     
    