A closet is part of the building. It does not move house with you, it is usually sold with the property, and altering it may not be possible in a rental.
US vs UK: British English rarely uses "closet" for clothes storage at all — "wardrobe" covers both built-in and freestanding, and "closet" survives mostly in fixed phrases.
Not the same as a wardrobe in the American sense, which is freestanding furniture, or a walk-in closet, which is a small room you enter rather than a cabinet you open.