Bugfix: should use local variable when _close()