Fix bug with open/close service multiple times.