Fix PCT-1045 by settings write deadline before Close(), also always reset deadlines in other funcs.