Fix monitor-resurrection test.

Try to avoid the pinning of the object that needs to be finalized.
Merge pull request #1421 from BrzVlad/fix-monitor-resurrection

Fix monitor-resurrection test.