Bug #9280: "Add postgis layer" creates a connection that is not removed until qgis is terminated

Changes:
+ disconnect postgres connections created.
+ fix deleteLayer not called in thread without event loop. 
   From Qt documentation: void QObject::deleteLater() [slot]  ...the object will be deleted once the event loop is started. If deleteLater() is called after the main event loop has stopped, the object will not be deleted. Since Qt 4.8, if deleteLater() is called on an object that lives in a thread with no running event loop, the object will be destroyed when the thread finishes.