Bug fix: close unauthorizedDatabase