Python script to write the name of all the files in a directory to a text file