clean up term on exit