finished video 29
Implemented the closeConnection Function