Ultracold neutron detector for neutron lifetime measurements