Refactor addTimestampMarker to return a timestamp object with open and close methods.