Try cleaning the positional sensor if tailgate door wont latch
I have a 2003 4-runner whose tailgate latch stopped working. Just a follow up. The disconnect battery followed by 3 lock/unlock worked for a while, but then the problem came back after the first time I opened then closed the hatch...