finish function to complete one message