make sure packs to be replaced are closed beforehand
Especially on Windows where an opened file cannot be replaced, make sure pack-objects always close packs it is about to replace. Even on non Windows systems, this could save potential bad results if ever objects were to be read from the new pack file using offset from the old index.
This should fix t5303 on Windows.
Signed-off-by: Nicolas Pitre <email@example.com> Tested-by: Johannes Sixt <firstname.lastname@example.org> (MinGW) Signed-off-by: Junio C Hamano <email@example.com>