added close connections to DB
add syso to debug
fix closing db connection 2
Merge pull request #3 from aycheh/bug_fix_upload_image

Bug fix upload image and db connection prob