Move UniqueHandle out from Serial plugin and make it part of lib.