Fix the issue that closing browser will cause server crash