A function invocation finishes once termination is signaled. Any code run after graceful termination cannot access the CPU, and will not make any progress. In addition, when a subsequent invocation is executed in the same environment, your background activity resumes, interfering with the new invocation. This may lead to unexpected behavior and errors that are hard to diagnose. Accessing the network after a function finishes usually leads to connections being reset (and the ECONNRESET error code).
Background activity is anything that happens after your function has terminated. It can often be detected in logs from individual invocations by finding anything that is logged after the line saying that the invocation finished. Background activity can sometimes be buried deeper in the code, especially when asynchronous operations such as callbacks or timers are present. Review your code to make sure that all asynchronous operations finish before you terminate the function.