Fix potential Db errors
- Close Statements and ResultSets
- Use TEXT, INTEGER instead of varchar, boolean