Fix up JRuby issues (inc. more cleanup at shutdown)