Fix path_is_dir and path_exists on Windows (#9618)