State workers ratify contract, avoid layoffs