Analysis of a dynamic contact problem with nonmonotone friction and non-clamped boundary conditions