Add open and close connection