Fix race condition between sending a timeout exception and sending the result.