It should be safe as long as you unplug the microwave oven when not in use (or use a switched outlet).
The reason for this is that there is usually much more dust and lint inside a walk-in closet than there is in a kitchen. All the highly inflammable material gets deposited and compacted by the forced cooling air circulation (virtually every MW as a fan) and may lead to a fire even when the microwave oven is not in use at that moment. I've read about at least two such fires in our council newsletter over last five years.
Note that you can't effectively clean the inside of a microwave oven (the inside where the electronics are, not the cavity behind the door where you put the rice) and taking it apart for cleaning is unadvisable at the very least, so caution is the only way to go. If you use a switched outlet, the switch isn't subject to the airflow (or is it a lintflow?) and so it is much more immune to the becoming a fire hazard.