Now creates and closes database