Prevent closing connections on transaction commit on sqlite in-memory databases

When committing transactions on in-memory (:memory:) sqlite databases the connection should not be closed - closing the connection causes the database to be dropped/reset. This request contains a test as well as a (somewhat hacky) solution to this problem.
Since it is sqlite specific, I think this would fit better in the sqlite connectionmanager's releaseConnection method