Fixed cursor bug. Closed databases.