Hello,
when cleaning your hamster cage, you should be putting your hamster in a travel cage or a playpen that you should have prepared for your hamster. Make sure your hamster can be seen by you at all times incase anything unexpected happens.
Good luck cleaning your cage and good luck with your hamster!