Fixed DB problem: PreparedStatements was not closed

First try of implementation of postgresql server access (still not working)