Revert "Another attempt at closing databases"

This reverts commit 902811f499a95f03f87813f2f650b592bcd1dc73.