Detach database on close if attached as alias