fixing closing issues