graceful shutdown of postgres, to prevent data coruption