Fixed a couple potential memory leaks and fixed missing header in file_db.h