fix incorrect completion when closing