A search for the electric dipole moment of the neutron using ultracold neutrons