Senior magistrate criticises court closures in Wales