Measuring the escape velocity and mass profiles of galaxy clusters beyond their virial radius