Fix timeout code on Windows