[Minor] cleaned up exception message
[Bugfix] don't check db connection for realms which are transient
[Bugfix] Don't close unopened connection

When a PostgreSQL transaction is opened without any objects being
modified or queried, then the connection won't be opened, thus no need
to close it.