Bankruptcy of General Motors' South Korean operation appears to have been averted at the last minute after the automaker agreed a deal with its labour union.