ND's newest refinery sold at a loss, most jobs to remain