 				state.timer = serialContext.singleTimer(interval: interval) {
 					if let l = last {
 						_ = timerInput?.send(value: l)
+						last = nil
 					}
 				}
-			case .result2(.failure(let e)): n.send(error: e)
+			case .result2(.failure(let e)):
+				if flushOnClose, let l = last {
+					_ = timerInput?.send(value: l)
+					last = nil
+				}
+				n.send(error: e)
 			case .result1(.success(let v)): n.send(value: v)
 			case .result1(.failure(let e)): n.send(error: e)
 			}

			case (.result1(.success(let v)), _): last = v
			case (.result1(.failure(let e)), _): n.send(error: e)
			case (.result2(.success), .some(let l)): n.send(value: l)
			case (.result2(.success), _): break
			case (.result2(.failure(let e)), _): n.send(error: e)
			}

	///
	/// - parameter seconds: the duration over which to drop values.
	/// - returns: a signal where values are emitted after a `timespan` but only if no another value occurs during that `timespan`.
	public func debounce(interval: DispatchTimeInterval, flushOnClose: Bool = true, context: Exec = .direct) -> Signal<T> {
		let serialContext = context.serialized()
		var timerInput: SignalInput<T>? = nil
		let timerSignal = Signal<T>.generate(context: serialContext) { input in
