Write response before shutting down