(Win) Fix creating file as directory when no directory specified.

std::string::find_last_of()'s return value wasn't being checked for
no-occurrences.
Give better error when failing to create directory.