Revert "remove obsolete statements in tests"

This reverts commit f56166269cdce82552a2998590970d2457747a6f.
use another syntax for closing handle