Add shutdown hook to flush out pending requests.