My assumption was that the lock is released when the OutputStream is closed. But I have to admin I didn't test this. I will do some tests with these APIs to get a better understanding.

Also the lock is VM wide, which means we might get in trouble with locking if there are concurrent dump operations within the same VM (e.g. though the new runtime API).