Do a proper java shutdown