In short: no, you have to rewrite the DLL code to work how you want it to.
You can't force a function to return. What you could do perhaps is to call the DLL function that's not returning in a timely manner in a separate thread, then when you want it to stop you just kill the thread. But that's not likely to be a good solution. As you wrote the DLL, probably the best way is to turn any loop control over to the caller so that any repetition the DLL function does is actually controlled by the Java program, then if you don't want it to repeat you just stop calling it, making sure to add any cleanup code that may be necessary.
Alternatively if the DLL is threadsafe you could add a "stop running" function and add a check within the code that isn't returning for whether or not that function has been called.