Ensuring all futures are processed while terminating