Improved handling of "Boolean" type, added necessary close() call