The top bureaucrat at Japan's finance ministry quits following allegations he sexually harassed female reporters, saying he wanted to clear his name.