As the rest said its a bug. Best thing to do is to go into the "text.txt" file tab beside the script.py tab on the top of the editor interface on codeacademy and put a space at the end of the 3rd line. I did that, then rewrote to file (r+ for read/write instead of a for append) and got success with the following code:
my_file = open('text.txt', "r+")
my_file.write("Hello file not working.\n")
my_file.write("Its 5 years as a bug.\n")
my_file.write("And another 5 to its fix.\n")
my_file = open("text.txt", "r")
I was successful ONLY after I spaced the 3rd line of the text.txt file by jumping into it at the tabs on top of the editor interface where you have script.py | text.txt.