added delay on close