Choosing the moment to die