Alternative fix for #3567

As discussed in #5825, this puts handles that should be preserved into a global ObjectIdDict. The only slightly sketchy parts are the idle and async worker invocations which I'll have to think about (we don't have a good interface for them yet, really), but it's not as simple as just putting a wait() based interface on top, since people are using them for synchronization with threaded C libraries.
Merge branch 'kf/ioiddict' of github.com:JuliaLang/julia into kf/ioiddict