This is pretty old thread - but I happened to see the same error code - just to give my thought.
I tried to call task_destroy from another task other than main then I had the error. My work around is to set a flag and let the main task to call task_destroy instead. This is not just related to task_destroy - free memory from another task other than main will produce same error. I do not know if doing so might cause other side effects or not - I just use my work around.
David