Disconnect from database function