fix bug on mongodb close