Allow localhost graceful shutdown (#3650)