Reverse breathing in diesel engines for aftertreatment thermal management