Fix possible race condition during unexpected RTMP shutdown