fixed error on close!