Return modified State from close_if_idle.

Also multiply ms instead of dividing us in order to avoid floats.