You can safely freeze most foods right up to the use by date, not only on the day of purchase. It’s best to freeze it as soon as you know you aren’t going to use it before its use by date.
Source: Use by and best before dates @ Food Standards Agency
image: Pork Shoulders by John Verive under Creative Commons license