It is agreed that it is only God who takes away life at the time of death. But you should also remember that God has made this world a world of causes. He has created causes for death also like falling from roof, becoming ill or being murdered etc. Surely all these events become causes of death but the same is not absolutely essential because it can be also be seen that some people were seriously ill but they did not die of that illness. Of course when their lifespan comes to end even a light and ordinary thing can also become the reason of death and the Lord of the universe takes away his life. It is also seen that some people die without even the slightest illness.
source : http://www.maaref-foundation.com