API tests: fix file handle leak in SBT, thread exhaustion in Travis

I believe I finally have a handle on the multiple problems, and have fixed or worked around them here. What a pain.
Any code which relies on `Thread.sleep` to avoid leaking resources or for some other dimension of correctness is broken by design. If a garbage collection or other system hiccup occurs, the time will elapse correctly, but no other work may be done, in which case the `Thread.sleep(X)` is equivalent to `Thread.sleep(0)` is equivalent to not sleeping. Another way to state this is that any code which uses `Thread.sleep` will operate as if it did not use `Thread.sleep` some percentage of the time.

I don't allow `Thread.sleep` in tests for two reasons: (a) it's broken by design (see above), (b) it forces tests to run for a mandatory minimum, instead of being more responsive (tests which repeatedly check that conditions are satisfied will run faster than tests which just sleep for a while and hope things turn out OK).

Whether you sleep or check thread status, the test is coded to the implementation. That's bad. But sometimes libraries give us no choice. So given a choice between two bad options, I want the one that, while still coded to our knowledge of a particular implementation, will work deterministically with respect to that implementation, instead of failing randomly.

Not saying that waiting on threads to finish is the best hack to solve this particular problem, but I'm pretty sure we can do better than sleeping a hard-coded amount of time, which is equivalent to not sleeping at all in some subset of runtime cases.