parse_filename: Fixed issues when file name contains dots.

Unfortunately the code of `parse_filename` seems to be duplicated. This patch should fix problems that arise when the file name contains dots. Obviously `name = fname.split('.')[0]` will not work in this case.

This should fix issue #6260.
We should probably use `os.path` to make this test equivalent on Windows. I think the easiest way is to use `os.path.abspath('test.ipynb')`.