Implementing my openConnection and closeConnection functions