Now deals with spaces in filename correctly

It was not opening files that had spaces in the filename, now it should