A stochastic maximum principle with dissipativity conditions