Simplified the process of closing a connection