Cofiniteness of local cohomology modules for ideals of small dimension