join_layers_if_needed function

Helper function to join layers for Assay5 objects