applyupdates: assign variable before we try to use it (issue3855)

The variable 'fd' was getting used with a value left over from a prior
iteration, causing a KeyError: '.hgsubstate'.

--HG--
branch : stable
extra : source : 0705ad73e87878304eb21282feaf258f18cb2083
extra : amend_source : ae44adf5e7f77cb75bcdfca2c3a06bb4328ccf52
Added tag 2.5.4 for changeset 8a7bd2dccd44

--HG--
branch : stable
Added signature for changeset 8a7bd2dccd44

--HG--
branch : stable
merge with stable