JMeter "asks" threads to stop when the lifetime ends.
If response time is higher than the test duration it might be the case that JMeter will wait for the response prior to finishing the thread.
If you need to stop the test in 5 seconds make sure to limit the JMeter's timeout to be 5 seconds maximum.
If you're using HTTP Request samplers - the setting lives under "Advanced" tab
If you have multiple HTTP Request samplers - it's a good idea to use HTTP Request Defaults so you could define the timeout in one place.
Other JMeter Configuration Elements and/or Samplers also have timeout settings.
If there are no timeouts - there is stoptest script which could be used for terminating the running test (be aware that it will be "force" termination and may result in false negative results)