Thanks for posting your query.
The ear infection
and difficulty to close mouth may be due to-
Pericoronitis of impacted wisdom tooth
I would advice you to visit a dentist
and get your mouth as well as TMJ checked.
Impacted wisdom tooth has to be extracted or flap overlying tooth has to be removed.
If TMJ is dislocated,it has to be immobilized and splinting has to be done.
If problem still exists,please do visit an ENT specialist