@gyeh should have a finally with buffer.close()