I doubt it's the ecu. Although and electrical problem is likely.
Have you checked the hatch wiring? it was a common problem that the wiring from the body going into the hatch has broken causing all kinds of weird problems for people.
Moderator Pilot, Former Focus Caretaker ╠╬╝, 2011 Ford Edge SEL AWD