Nowata County Sheriff resigns after judge orders jail back open