Fix default output filename being '.txt' if a trailing slash is given for the input directory