Abort pending postgis connexions when an exception kills map rendering -  closes #2042

A fix, with a testcase.