fixed wrong unmapping of buffer on close