Added closeConnection() to fix an error