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.
please change all instances of `options.inMemory||options.uuid` to `options.inMemory || options.uuid`