buildPacket

Build a byte packet in block lambda. Creates a temporary builder and releases it in case of failure