Fixed panic in postgres shutdown