Rename leave to cleanup

The name ‘leave’ can not be used on some Windows CE platforms, so rename it.