Safely disconnect signals in regression tests.