Add close() methods as suggested by Boros Márton.