path.extname implementation adapted to also include multiple dots extensions.