Added support for resource cleanup and done callback list clearing

- Added a Thread.terminate() method to clean up resources
- Added a ThreadPool.terminateAll() method to clean up resources in order to work around the firefox web worker thread limit