http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_task.htm
There is a field called status in task .Setting Setting this to the string "Closed"'Completed' solves the issue .No No need to write this isclosedisClosed flag .This This flag gets checked once task status is closed .