Hartlepool United's 96-year stay in the Football League ended despite victory over Doncaster on the final day.