move blocking section and flush file

Signed-off-by: John Else <john.else@citrix.com>
non-infinite timeout

Signed-off-by: John Else <john.else@citrix.com>
timeout is in milliseconds!

Signed-off-by: John Else <john.else@citrix.com>