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.
I don't see how waiting for the threads to go away is any better. That means relying on being able to detect those threads accurately, which means making some assumptions about the implementation. Having read the code, I know they hard-coded it to wait 2 seconds, so why not just make that assumption and be done with it. I don't need it to be precise (which is why I'm just waiting one second), just close enough to prevent having more than a small number of quiescent thread pools at any one time.