initial commit, attempt to close and re-open connections as necessary to flush session parameters

Need to evaluate if this is the correct procedure for performance and robustness
changed soft and hard open/close connection handling