Fixed threading bug

- Fixed thread issue throwing errors after server close