Removed close database from del function. DB has to be closed manually.