There is an automatic reset circuit breaker in the battery junction box (BJB) and inside the window motor itself. If overloaded, the CB will trip and shut it down.
After it cools, the CB will automatically reset. So this offers a reason why it works sometimes and not others.
Bottom line is something is causing the motor to over heat.