Mark a pg connection as invalid on connection err. Builds on PR #2557 by @jawj