bug fix: wrong close handling