Check if backup is already in progress
You can customize this to your needs - (I agree that you should not be shrinking files as part of a scheduled maintenance task - Read these words of wisdom.)

DECLARE @SqlText VARCHAR(max)
DECLARE @BackupIsRunning BIT = 1 --Force initial value to 1

WHILE @BackupIsRunning = 1
BEGIN
    SELECT @SqlText = s.TEXT --Check for any BACKUP commands currently running
    FROM sys.dm_exec_requests r
    CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) s
    WHERE r.command IN (
            'BACKUP DATABASE'
            ,'BACKUP LOG'
            )

    IF @@ROWCOUNT = 0 --If @@ROWCOUNT = 0, then no backups are running
    BEGIN
        SET @BackupIsRunning = 0 --Drop out of WHILE loop

        BREAK
    END

    WAITFOR DELAY '00:00:10' --Take a break and check again
END