The plant isn't dying - or at least iyou should be able to stable i.e. it enough to get it finish. No idea what the real problem is.
Is it getting any mag. from the soil? If not that may be the problem. Bat quano will give it nitrogen without burning it if it's a problem in that area...