Fixed logic to extract file name from path (on Windows)