Refactor api to explicitly close mysql connections
Merge pull request #8 from mediasuitenz/fix/api_crashes#TMP-300

Refactor api to explicitly close mysql connections