Big Hero 6
(2014)

Short version:
The villain in the Kabuki mask controlling the micro-bot army is not Alistair Krei, but Professor Callaghan, who had just faked his death.  Callaghan's daughter didn't die in that teleportation test, but is instead in hyper-sleep inside the portal.  Hiro and Baymax rescue her, but Baymax is lost in the process.  Later, however, Hiro brings it back and goes on to keep fighting crime in the city with his friends.

Longer, detailed version:
Hiro and the gang discover that the micro-bot-controlling villain with the Kabuki mask is actually Professor Callaghan, who was presumed dead in the fire earlier in the movie and whom Tadashi (Hiro's older brother) died trying to save.  This sends Hiro on a rage fit and has Baymax reprogrammed into a destructive mode to try and have Callaghan killed, not wanting to hear anything else.  The gang manages to get Baymax back to normal and stop him because doing this wasn't part of the plan, but Callaghan escapes again with the neuro-transmitting controller.  Hiro goes home and fixes Baymax's scanner, which got damaged in the struggle, and tries to get it to find and destroy Callaghan, but Baymax refuses and, instead, shows Hiro clips of back when Tadashi first built and tried Baymax out.  Hiro cries over this and then apologizes to his friends, who comfort him.

Then, while going over the footage of the teleportation tryout, Honey discovers that the woman used in the test was Callaghan's daughter, Abigail, and she apparently got lost and killed due to "malfunction".  Alistair Krei wasn't actually guilty of anything, he was just an ambitious entrepreneur with a grandiose vision.  The gang rushes to Krei's company headquarters to prevent him but, just as they arrive, Callaghan beats them to it and reassembles the portal with his micro-bot army to destroy Krei and his company.  A major battle ensues, in which Callaghan traps the 6 with micro-bots, they manage to set free and get the micro-bots sucked through the portal to be obliterated; eventually, Callaghan is stripped off the mask again and he falls, defeated, along with the portal.  However, it is still active and Baymax detects a human presence in it: it turns out Abigail is on the other side of the portal and is not dead, but just in hyper-sleep.

Hiro and Baymax rush through the portal and a cloud of debris to retrieve Abigail's pod and bring her out safely.  On their way out, though, they are struck by a masive chunk of debris.  Baymax takes the hit, which destroys almost all of his armor and renders his thrusters inoperable.  The robot realizes the thruster on one of its fists works and can bring Hiro and Abigail back home, but, in order to do so, it must be shut down by Hiro "telling it he is satisfied with its service", thus sacrificing itself.  Hiro refuses to lose his friend, but then understands it and has a tearful embrace and farewell; Hiro and Abigail are propelled out safely and Baymax falls into oblivion.  Abigail is taken to the hospital and Callaghan is arrested.

Back in Tadashi's former lab, Hiro checks Baymax hand that saved him and notices the green personality card, the one with Tadashi's name on, was in it.  He joyfully manages to bring Baymax back to life, the gang of 6 is fully reunited and they continue fighting crime in San Fransokyo.

Post-credit scene (Like in any good recent Marvel-related movie):
Fred returns to his mansion and, while having a moving conversation with a picture of his father, unknowingly activates a door to a secret room; it contains superhero gadgets and gear.  Then, suddenly, behind comes his father (voiced by Stan Lee, of course), they embrace and say they have a lot to discuss.  This leaves open the possibility of a sequel to come.

Thanks Julio M!