The downloadHandler() function in Shiny apps times out after about 60 seconds. So if processing inside that function takes longer than 60 seconds, the download will fail.
Some potential solutions are discussed here.
Is there a ShinyProxy solution to this?