LG is shutting down its struggling mobile business after failing to reverse years of losses.