But Yahweh didn't like what he had done and so he killed Onan too in the same way he had killed his older brother Er.