add missing call to closeConnection() in createRandom(), reformat