A court order has forced a mouse-infested takeaway to close following an inspection which revealed a risk to public safety.