diff --git a/core/lib/Drupal/Core/Database/Database.php b/core/lib/Drupal/Core/Database/Database.php
index dd19018..beaaf7d 100644
--- a/core/lib/Drupal/Core/Database/Database.php
+++ b/core/lib/Drupal/Core/Database/Database.php
@@ -470,7 +470,7 @@
     if ($info['path'][0] === '/') {
       $info['path'] = substr($info['path'], 1);
     }
-    if ($info['scheme'] === 'sqlite' && $info['path'][0] !== '/') {
+    if ($info['scheme'] === 'sqlite' && $info['path'][0] !== '/' && $info['path'][0] !== ':') {
       $info['path'] = $root . '/' . $info['path'];
     }
 
diff --git a/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php b/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php
index a7c1496..5c8beb6 100644
--- a/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php
+++ b/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php
@@ -181,7 +181,7 @@
           $count = $this->query('SELECT COUNT(*) FROM ' . $prefix . '.sqlite_master WHERE type = :type AND name NOT LIKE :pattern', [':type' => 'table', ':pattern' => 'sqlite_%'])->fetchField();
 
           // We can prune the database file if it doesn't have any tables.
-          if ($count == 0) {
+          if ($count == 0 && $this->connectionOptions['database'][0] != ':') {
             // Detaching the database fails at this point, but no other queries
             // are executed after the connection is destructed so we can simply
             // remove the database file.
