Handle server shutdown