Added automatic closing of database connection to goProfile function