fix set maxlifetime, close conn

#369