coreserver: Improve shutdown

Signed-off-by: Michael Buesch <m@bues.ch>