We investigate the stability of magnetically trapped atomic Bose-Einstein condensates and thermal clouds near the transition temperature at small distances 0.5 µmd10 µm from a microfabricated silicon chip. For a 2 µm thick copper film, the trap lifetime is limited by Johnson noise induced currents and falls below 1 s at a distance of 4 µm. A dielectric surface does not adversely affect the sample until the attractive Casimir-Polder potential significantly reduces the trap depth.