http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_task.htm

There is a field called status in task .Setting this to string "Closed" solves the issue .No need to write this isclosed flag .This flag gets checked once task status is closed .