This isn't how the law works at all. You can absolutely still be charged with theft even if you return the item.