So initially when they engaged landing gear down lever, the safety valves shut down and didn't allow the landing gear to lower as the speed was too high.from what i have heard the PC/PR (pilot on radio/comm) was first officer so i presume PF (pilot flying) was the captain, gear was lowered at 10nm but was raised at 5nm i guess because of ECAM (Electronic Centralized Aircraft Monitor) warnings and than they forgot to lower it again due to sheer pressure of landing the jet
Then plane slows down below the safety limits and landing gear deployed.
On A320 the landing gears don't retract automatically if the plane again over speeds after deployment, they remain open.
If retraction is needed it has to be done manually.
At 5 milies the gears were retracted, so they were retracted manually by one of the pilots.
Why the pilot did so while continuing the approach and not aborting it, needs to be investigated.