Tasks remain in the Task view for 2 minutes after they are completed and then they are removed from the Task view.
There is no general cause or solution to Tasks getting stuck. If tasks are completed and remains in the Task view for more than 2 minutes, or the instance behind the Task is completed but the Task remains in the Task view the support team could be engaged to more closely review and assist.