CA-146822: fix intermittent test fialures

As the lock test was querying the GC for the collected locks, it might
be possible that when the test starts, there is already an uncollected
lock in the GC. To avoid this situation, run the GC, so only the garbage
created by the test will be collected.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>