Clean up tern web workers whenever we re-init the tern server, or close a project.

If we don't call terminate on the worker, it appears that the worker, and all the memory it's using will never get collected.  So when we were switching projects, we were leaving behind orphaned workers, resulting in a large memory leak.

To enable re-initing the web worker I had to change around the logic - now the worker sends a message when it is done being init'ed and the main thread waits for that message before it starts sending messages to the workers.
Update tern - slow down memory growth when editing codemirror.js

helps with issue #3977
cleanup - add missing jsdoc
Ensure addFilesPromise won't produce null pointers if the worker is terminated before it is finished.
Merge pull request #3988 from eztierney/issue-3977

Update tern - slow down memory growth when editing codemirror.js
Merge pull request #3983 from eztierney/leaking-workers

Clean up tern web workers whenever we re-init the tern server, or close ...