It won't be ok if the function is using things that enqueue stuff. However, enqueueing asynchronous things when shutting down isn't supposed to work anyway..