The Australian sharemarket closed just shy of recouping its year-to-date losses.