Stopped the heartbeat when shutting down middleware.