attempt to fix thread error on closing