Update documentation. Fix placing of .close() prematurely due to empty lines