The automatic shutdown is causes by a system error. Try performing a factory reset. Most likely one of the system files is corrupted and it's causing this issue. Turn off the phone then press Volume Up + Power Button until the phone enters Recovery menu. Select Wipe Data and restart the phone.