You can program an exit condition the same way as an enter condition, its then exitLong instead of enterLong.