[Bugfix] fix possible fd-leak