ruby: split database close and destroy