before task finish with promise