I don't do javascript but the programmer in me thinks it might not be wise to close that text file before all you need to do with the file is done. I mean, what if the txt file is pretty huge and not all of it can be copied into your var at once, since you don't have a loop, you end up loosing some data.
I might be wrong if javascipt implements its things differently.