write packet to file