don't need to close upstream
fix possible race condition